
obj/__user_faultread.out：     文件格式 elf32-i386


Disassembly of section .text:

00800020 <__panic>:
#include <stdio.h>
#include <ulib.h>
#include <error.h>

void
__panic(const char *file, int line, const char *fmt, ...) {
  800020:	f3 0f 1e fb          	endbr32 
  800024:	55                   	push   %ebp
  800025:	89 e5                	mov    %esp,%ebp
  800027:	83 ec 28             	sub    $0x28,%esp
    // print the 'message'
    va_list ap;
    va_start(ap, fmt);
  80002a:	8d 45 14             	lea    0x14(%ebp),%eax
  80002d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("user panic at %s:%d:\n    ", file, line);
  800030:	8b 45 0c             	mov    0xc(%ebp),%eax
  800033:	89 44 24 08          	mov    %eax,0x8(%esp)
  800037:	8b 45 08             	mov    0x8(%ebp),%eax
  80003a:	89 44 24 04          	mov    %eax,0x4(%esp)
  80003e:	c7 04 24 e0 10 80 00 	movl   $0x8010e0,(%esp)
  800045:	e8 37 03 00 00       	call   800381 <cprintf>
    vcprintf(fmt, ap);
  80004a:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80004d:	89 44 24 04          	mov    %eax,0x4(%esp)
  800051:	8b 45 10             	mov    0x10(%ebp),%eax
  800054:	89 04 24             	mov    %eax,(%esp)
  800057:	e8 ee 02 00 00       	call   80034a <vcprintf>
    cprintf("\n");
  80005c:	c7 04 24 fa 10 80 00 	movl   $0x8010fa,(%esp)
  800063:	e8 19 03 00 00       	call   800381 <cprintf>
    va_end(ap);
    exit(-E_PANIC);
  800068:	c7 04 24 f6 ff ff ff 	movl   $0xfffffff6,(%esp)
  80006f:	e8 bb 01 00 00       	call   80022f <exit>

00800074 <__warn>:
}

void
__warn(const char *file, int line, const char *fmt, ...) {
  800074:	f3 0f 1e fb          	endbr32 
  800078:	55                   	push   %ebp
  800079:	89 e5                	mov    %esp,%ebp
  80007b:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    va_start(ap, fmt);
  80007e:	8d 45 14             	lea    0x14(%ebp),%eax
  800081:	89 45 f4             	mov    %eax,-0xc(%ebp)
    cprintf("user warning at %s:%d:\n    ", file, line);
  800084:	8b 45 0c             	mov    0xc(%ebp),%eax
  800087:	89 44 24 08          	mov    %eax,0x8(%esp)
  80008b:	8b 45 08             	mov    0x8(%ebp),%eax
  80008e:	89 44 24 04          	mov    %eax,0x4(%esp)
  800092:	c7 04 24 fc 10 80 00 	movl   $0x8010fc,(%esp)
  800099:	e8 e3 02 00 00       	call   800381 <cprintf>
    vcprintf(fmt, ap);
  80009e:	8b 45 f4             	mov    -0xc(%ebp),%eax
  8000a1:	89 44 24 04          	mov    %eax,0x4(%esp)
  8000a5:	8b 45 10             	mov    0x10(%ebp),%eax
  8000a8:	89 04 24             	mov    %eax,(%esp)
  8000ab:	e8 9a 02 00 00       	call   80034a <vcprintf>
    cprintf("\n");
  8000b0:	c7 04 24 fa 10 80 00 	movl   $0x8010fa,(%esp)
  8000b7:	e8 c5 02 00 00       	call   800381 <cprintf>
    va_end(ap);
}
  8000bc:	90                   	nop
  8000bd:	c9                   	leave  
  8000be:	c3                   	ret    

008000bf <syscall>:
#include <syscall.h>

#define MAX_ARGS            5

static inline int
syscall(int num, ...) {
  8000bf:	55                   	push   %ebp
  8000c0:	89 e5                	mov    %esp,%ebp
  8000c2:	57                   	push   %edi
  8000c3:	56                   	push   %esi
  8000c4:	53                   	push   %ebx
  8000c5:	83 ec 20             	sub    $0x20,%esp
    va_list ap;
    va_start(ap, num);
  8000c8:	8d 45 0c             	lea    0xc(%ebp),%eax
  8000cb:	89 45 e8             	mov    %eax,-0x18(%ebp)
    uint32_t a[MAX_ARGS];
    int i, ret;
    for (i = 0; i < MAX_ARGS; i ++) {
  8000ce:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
  8000d5:	eb 15                	jmp    8000ec <syscall+0x2d>
        a[i] = va_arg(ap, uint32_t);
  8000d7:	8b 45 e8             	mov    -0x18(%ebp),%eax
  8000da:	8d 50 04             	lea    0x4(%eax),%edx
  8000dd:	89 55 e8             	mov    %edx,-0x18(%ebp)
  8000e0:	8b 10                	mov    (%eax),%edx
  8000e2:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8000e5:	89 54 85 d4          	mov    %edx,-0x2c(%ebp,%eax,4)
    for (i = 0; i < MAX_ARGS; i ++) {
  8000e9:	ff 45 f0             	incl   -0x10(%ebp)
  8000ec:	83 7d f0 04          	cmpl   $0x4,-0x10(%ebp)
  8000f0:	7e e5                	jle    8000d7 <syscall+0x18>
    asm volatile (
        "int %1;"
        : "=a" (ret)
        : "i" (T_SYSCALL),
          "a" (num),
          "d" (a[0]),
  8000f2:	8b 55 d4             	mov    -0x2c(%ebp),%edx
          "c" (a[1]),
  8000f5:	8b 4d d8             	mov    -0x28(%ebp),%ecx
          "b" (a[2]),
  8000f8:	8b 5d dc             	mov    -0x24(%ebp),%ebx
          "D" (a[3]),
  8000fb:	8b 7d e0             	mov    -0x20(%ebp),%edi
          "S" (a[4])
  8000fe:	8b 75 e4             	mov    -0x1c(%ebp),%esi
    asm volatile (
  800101:	8b 45 08             	mov    0x8(%ebp),%eax
  800104:	cd 80                	int    $0x80
  800106:	89 45 ec             	mov    %eax,-0x14(%ebp)
        : "cc", "memory");
    return ret;
  800109:	8b 45 ec             	mov    -0x14(%ebp),%eax
}
  80010c:	83 c4 20             	add    $0x20,%esp
  80010f:	5b                   	pop    %ebx
  800110:	5e                   	pop    %esi
  800111:	5f                   	pop    %edi
  800112:	5d                   	pop    %ebp
  800113:	c3                   	ret    

00800114 <sys_exit>:

int
sys_exit(int error_code) {
  800114:	f3 0f 1e fb          	endbr32 
  800118:	55                   	push   %ebp
  800119:	89 e5                	mov    %esp,%ebp
  80011b:	83 ec 08             	sub    $0x8,%esp
    return syscall(SYS_exit, error_code);
  80011e:	8b 45 08             	mov    0x8(%ebp),%eax
  800121:	89 44 24 04          	mov    %eax,0x4(%esp)
  800125:	c7 04 24 01 00 00 00 	movl   $0x1,(%esp)
  80012c:	e8 8e ff ff ff       	call   8000bf <syscall>
}
  800131:	c9                   	leave  
  800132:	c3                   	ret    

00800133 <sys_fork>:

int
sys_fork(void) {
  800133:	f3 0f 1e fb          	endbr32 
  800137:	55                   	push   %ebp
  800138:	89 e5                	mov    %esp,%ebp
  80013a:	83 ec 04             	sub    $0x4,%esp
    return syscall(SYS_fork);
  80013d:	c7 04 24 02 00 00 00 	movl   $0x2,(%esp)
  800144:	e8 76 ff ff ff       	call   8000bf <syscall>
}
  800149:	c9                   	leave  
  80014a:	c3                   	ret    

0080014b <sys_wait>:

int
sys_wait(int pid, int *store) {
  80014b:	f3 0f 1e fb          	endbr32 
  80014f:	55                   	push   %ebp
  800150:	89 e5                	mov    %esp,%ebp
  800152:	83 ec 0c             	sub    $0xc,%esp
    return syscall(SYS_wait, pid, store);
  800155:	8b 45 0c             	mov    0xc(%ebp),%eax
  800158:	89 44 24 08          	mov    %eax,0x8(%esp)
  80015c:	8b 45 08             	mov    0x8(%ebp),%eax
  80015f:	89 44 24 04          	mov    %eax,0x4(%esp)
  800163:	c7 04 24 03 00 00 00 	movl   $0x3,(%esp)
  80016a:	e8 50 ff ff ff       	call   8000bf <syscall>
}
  80016f:	c9                   	leave  
  800170:	c3                   	ret    

00800171 <sys_yield>:

int
sys_yield(void) {
  800171:	f3 0f 1e fb          	endbr32 
  800175:	55                   	push   %ebp
  800176:	89 e5                	mov    %esp,%ebp
  800178:	83 ec 04             	sub    $0x4,%esp
    return syscall(SYS_yield);
  80017b:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
  800182:	e8 38 ff ff ff       	call   8000bf <syscall>
}
  800187:	c9                   	leave  
  800188:	c3                   	ret    

00800189 <sys_kill>:

int
sys_kill(int pid) {
  800189:	f3 0f 1e fb          	endbr32 
  80018d:	55                   	push   %ebp
  80018e:	89 e5                	mov    %esp,%ebp
  800190:	83 ec 08             	sub    $0x8,%esp
    return syscall(SYS_kill, pid);
  800193:	8b 45 08             	mov    0x8(%ebp),%eax
  800196:	89 44 24 04          	mov    %eax,0x4(%esp)
  80019a:	c7 04 24 0c 00 00 00 	movl   $0xc,(%esp)
  8001a1:	e8 19 ff ff ff       	call   8000bf <syscall>
}
  8001a6:	c9                   	leave  
  8001a7:	c3                   	ret    

008001a8 <sys_getpid>:

int
sys_getpid(void) {
  8001a8:	f3 0f 1e fb          	endbr32 
  8001ac:	55                   	push   %ebp
  8001ad:	89 e5                	mov    %esp,%ebp
  8001af:	83 ec 04             	sub    $0x4,%esp
    return syscall(SYS_getpid);
  8001b2:	c7 04 24 12 00 00 00 	movl   $0x12,(%esp)
  8001b9:	e8 01 ff ff ff       	call   8000bf <syscall>
}
  8001be:	c9                   	leave  
  8001bf:	c3                   	ret    

008001c0 <sys_putc>:

int
sys_putc(int c) {
  8001c0:	f3 0f 1e fb          	endbr32 
  8001c4:	55                   	push   %ebp
  8001c5:	89 e5                	mov    %esp,%ebp
  8001c7:	83 ec 08             	sub    $0x8,%esp
    return syscall(SYS_putc, c);
  8001ca:	8b 45 08             	mov    0x8(%ebp),%eax
  8001cd:	89 44 24 04          	mov    %eax,0x4(%esp)
  8001d1:	c7 04 24 1e 00 00 00 	movl   $0x1e,(%esp)
  8001d8:	e8 e2 fe ff ff       	call   8000bf <syscall>
}
  8001dd:	c9                   	leave  
  8001de:	c3                   	ret    

008001df <sys_pgdir>:

int
sys_pgdir(void) {
  8001df:	f3 0f 1e fb          	endbr32 
  8001e3:	55                   	push   %ebp
  8001e4:	89 e5                	mov    %esp,%ebp
  8001e6:	83 ec 04             	sub    $0x4,%esp
    return syscall(SYS_pgdir);
  8001e9:	c7 04 24 1f 00 00 00 	movl   $0x1f,(%esp)
  8001f0:	e8 ca fe ff ff       	call   8000bf <syscall>
}
  8001f5:	c9                   	leave  
  8001f6:	c3                   	ret    

008001f7 <sys_gettime>:

int
sys_gettime(void) {
  8001f7:	f3 0f 1e fb          	endbr32 
  8001fb:	55                   	push   %ebp
  8001fc:	89 e5                	mov    %esp,%ebp
  8001fe:	83 ec 04             	sub    $0x4,%esp
    return syscall(SYS_gettime);
  800201:	c7 04 24 11 00 00 00 	movl   $0x11,(%esp)
  800208:	e8 b2 fe ff ff       	call   8000bf <syscall>
}
  80020d:	c9                   	leave  
  80020e:	c3                   	ret    

0080020f <sys_lab6_set_priority>:

void
sys_lab6_set_priority(uint32_t priority)
{
  80020f:	f3 0f 1e fb          	endbr32 
  800213:	55                   	push   %ebp
  800214:	89 e5                	mov    %esp,%ebp
  800216:	83 ec 08             	sub    $0x8,%esp
    syscall(SYS_lab6_set_priority, priority);
  800219:	8b 45 08             	mov    0x8(%ebp),%eax
  80021c:	89 44 24 04          	mov    %eax,0x4(%esp)
  800220:	c7 04 24 ff 00 00 00 	movl   $0xff,(%esp)
  800227:	e8 93 fe ff ff       	call   8000bf <syscall>
}
  80022c:	90                   	nop
  80022d:	c9                   	leave  
  80022e:	c3                   	ret    

0080022f <exit>:
#include <syscall.h>
#include <stdio.h>
#include <ulib.h>

void
exit(int error_code) {
  80022f:	f3 0f 1e fb          	endbr32 
  800233:	55                   	push   %ebp
  800234:	89 e5                	mov    %esp,%ebp
  800236:	83 ec 18             	sub    $0x18,%esp
    sys_exit(error_code);
  800239:	8b 45 08             	mov    0x8(%ebp),%eax
  80023c:	89 04 24             	mov    %eax,(%esp)
  80023f:	e8 d0 fe ff ff       	call   800114 <sys_exit>
    cprintf("BUG: exit failed.\n");
  800244:	c7 04 24 18 11 80 00 	movl   $0x801118,(%esp)
  80024b:	e8 31 01 00 00       	call   800381 <cprintf>
    while (1);
  800250:	eb fe                	jmp    800250 <exit+0x21>

00800252 <fork>:
}

int
fork(void) {
  800252:	f3 0f 1e fb          	endbr32 
  800256:	55                   	push   %ebp
  800257:	89 e5                	mov    %esp,%ebp
  800259:	83 ec 08             	sub    $0x8,%esp
    return sys_fork();
  80025c:	e8 d2 fe ff ff       	call   800133 <sys_fork>
}
  800261:	c9                   	leave  
  800262:	c3                   	ret    

00800263 <wait>:

int
wait(void) {
  800263:	f3 0f 1e fb          	endbr32 
  800267:	55                   	push   %ebp
  800268:	89 e5                	mov    %esp,%ebp
  80026a:	83 ec 18             	sub    $0x18,%esp
    return sys_wait(0, NULL);
  80026d:	c7 44 24 04 00 00 00 	movl   $0x0,0x4(%esp)
  800274:	00 
  800275:	c7 04 24 00 00 00 00 	movl   $0x0,(%esp)
  80027c:	e8 ca fe ff ff       	call   80014b <sys_wait>
}
  800281:	c9                   	leave  
  800282:	c3                   	ret    

00800283 <waitpid>:

int
waitpid(int pid, int *store) {
  800283:	f3 0f 1e fb          	endbr32 
  800287:	55                   	push   %ebp
  800288:	89 e5                	mov    %esp,%ebp
  80028a:	83 ec 18             	sub    $0x18,%esp
    return sys_wait(pid, store);
  80028d:	8b 45 0c             	mov    0xc(%ebp),%eax
  800290:	89 44 24 04          	mov    %eax,0x4(%esp)
  800294:	8b 45 08             	mov    0x8(%ebp),%eax
  800297:	89 04 24             	mov    %eax,(%esp)
  80029a:	e8 ac fe ff ff       	call   80014b <sys_wait>
}
  80029f:	c9                   	leave  
  8002a0:	c3                   	ret    

008002a1 <yield>:

void
yield(void) {
  8002a1:	f3 0f 1e fb          	endbr32 
  8002a5:	55                   	push   %ebp
  8002a6:	89 e5                	mov    %esp,%ebp
  8002a8:	83 ec 08             	sub    $0x8,%esp
    sys_yield();
  8002ab:	e8 c1 fe ff ff       	call   800171 <sys_yield>
}
  8002b0:	90                   	nop
  8002b1:	c9                   	leave  
  8002b2:	c3                   	ret    

008002b3 <kill>:

int
kill(int pid) {
  8002b3:	f3 0f 1e fb          	endbr32 
  8002b7:	55                   	push   %ebp
  8002b8:	89 e5                	mov    %esp,%ebp
  8002ba:	83 ec 18             	sub    $0x18,%esp
    return sys_kill(pid);
  8002bd:	8b 45 08             	mov    0x8(%ebp),%eax
  8002c0:	89 04 24             	mov    %eax,(%esp)
  8002c3:	e8 c1 fe ff ff       	call   800189 <sys_kill>
}
  8002c8:	c9                   	leave  
  8002c9:	c3                   	ret    

008002ca <getpid>:

int
getpid(void) {
  8002ca:	f3 0f 1e fb          	endbr32 
  8002ce:	55                   	push   %ebp
  8002cf:	89 e5                	mov    %esp,%ebp
  8002d1:	83 ec 08             	sub    $0x8,%esp
    return sys_getpid();
  8002d4:	e8 cf fe ff ff       	call   8001a8 <sys_getpid>
}
  8002d9:	c9                   	leave  
  8002da:	c3                   	ret    

008002db <print_pgdir>:

//print_pgdir - print the PDT&PT
void
print_pgdir(void) {
  8002db:	f3 0f 1e fb          	endbr32 
  8002df:	55                   	push   %ebp
  8002e0:	89 e5                	mov    %esp,%ebp
  8002e2:	83 ec 08             	sub    $0x8,%esp
    sys_pgdir();
  8002e5:	e8 f5 fe ff ff       	call   8001df <sys_pgdir>
}
  8002ea:	90                   	nop
  8002eb:	c9                   	leave  
  8002ec:	c3                   	ret    

008002ed <gettime_msec>:

unsigned int
gettime_msec(void) {
  8002ed:	f3 0f 1e fb          	endbr32 
  8002f1:	55                   	push   %ebp
  8002f2:	89 e5                	mov    %esp,%ebp
  8002f4:	83 ec 08             	sub    $0x8,%esp
    return (unsigned int)sys_gettime();
  8002f7:	e8 fb fe ff ff       	call   8001f7 <sys_gettime>
}
  8002fc:	c9                   	leave  
  8002fd:	c3                   	ret    

008002fe <lab6_set_priority>:

void
lab6_set_priority(uint32_t priority)
{
  8002fe:	f3 0f 1e fb          	endbr32 
  800302:	55                   	push   %ebp
  800303:	89 e5                	mov    %esp,%ebp
  800305:	83 ec 18             	sub    $0x18,%esp
    sys_lab6_set_priority(priority);
  800308:	8b 45 08             	mov    0x8(%ebp),%eax
  80030b:	89 04 24             	mov    %eax,(%esp)
  80030e:	e8 fc fe ff ff       	call   80020f <sys_lab6_set_priority>
}
  800313:	90                   	nop
  800314:	c9                   	leave  
  800315:	c3                   	ret    

00800316 <_start>:
.text
.globl _start
_start:
    # set ebp for backtrace
    movl $0x0, %ebp
  800316:	bd 00 00 00 00       	mov    $0x0,%ebp

    # move down the esp register
    # since it may cause page fault in backtrace
    subl $0x20, %esp
  80031b:	83 ec 20             	sub    $0x20,%esp

    # call user-program function
    call umain
  80031e:	e8 db 00 00 00       	call   8003fe <umain>
1:  jmp 1b
  800323:	eb fe                	jmp    800323 <_start+0xd>

00800325 <cputch>:
/* *
 * cputch - writes a single character @c to stdout, and it will
 * increace the value of counter pointed by @cnt.
 * */
static void
cputch(int c, int *cnt) {
  800325:	f3 0f 1e fb          	endbr32 
  800329:	55                   	push   %ebp
  80032a:	89 e5                	mov    %esp,%ebp
  80032c:	83 ec 18             	sub    $0x18,%esp
    sys_putc(c);
  80032f:	8b 45 08             	mov    0x8(%ebp),%eax
  800332:	89 04 24             	mov    %eax,(%esp)
  800335:	e8 86 fe ff ff       	call   8001c0 <sys_putc>
    (*cnt) ++;
  80033a:	8b 45 0c             	mov    0xc(%ebp),%eax
  80033d:	8b 00                	mov    (%eax),%eax
  80033f:	8d 50 01             	lea    0x1(%eax),%edx
  800342:	8b 45 0c             	mov    0xc(%ebp),%eax
  800345:	89 10                	mov    %edx,(%eax)
}
  800347:	90                   	nop
  800348:	c9                   	leave  
  800349:	c3                   	ret    

0080034a <vcprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want cprintf() instead.
 * */
int
vcprintf(const char *fmt, va_list ap) {
  80034a:	f3 0f 1e fb          	endbr32 
  80034e:	55                   	push   %ebp
  80034f:	89 e5                	mov    %esp,%ebp
  800351:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
  800354:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    vprintfmt((void*)cputch, &cnt, fmt, ap);
  80035b:	8b 45 0c             	mov    0xc(%ebp),%eax
  80035e:	89 44 24 0c          	mov    %eax,0xc(%esp)
  800362:	8b 45 08             	mov    0x8(%ebp),%eax
  800365:	89 44 24 08          	mov    %eax,0x8(%esp)
  800369:	8d 45 f4             	lea    -0xc(%ebp),%eax
  80036c:	89 44 24 04          	mov    %eax,0x4(%esp)
  800370:	c7 04 24 25 03 80 00 	movl   $0x800325,(%esp)
  800377:	e8 4d 07 00 00       	call   800ac9 <vprintfmt>
    return cnt;
  80037c:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  80037f:	c9                   	leave  
  800380:	c3                   	ret    

00800381 <cprintf>:
 *
 * The return value is the number of characters which would be
 * written to stdout.
 * */
int
cprintf(const char *fmt, ...) {
  800381:	f3 0f 1e fb          	endbr32 
  800385:	55                   	push   %ebp
  800386:	89 e5                	mov    %esp,%ebp
  800388:	83 ec 28             	sub    $0x28,%esp
    va_list ap;

    va_start(ap, fmt);
  80038b:	8d 45 0c             	lea    0xc(%ebp),%eax
  80038e:	89 45 f0             	mov    %eax,-0x10(%ebp)
    int cnt = vcprintf(fmt, ap);
  800391:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800394:	89 44 24 04          	mov    %eax,0x4(%esp)
  800398:	8b 45 08             	mov    0x8(%ebp),%eax
  80039b:	89 04 24             	mov    %eax,(%esp)
  80039e:	e8 a7 ff ff ff       	call   80034a <vcprintf>
  8003a3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);

    return cnt;
  8003a6:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  8003a9:	c9                   	leave  
  8003aa:	c3                   	ret    

008003ab <cputs>:
/* *
 * cputs- writes the string pointed by @str to stdout and
 * appends a newline character.
 * */
int
cputs(const char *str) {
  8003ab:	f3 0f 1e fb          	endbr32 
  8003af:	55                   	push   %ebp
  8003b0:	89 e5                	mov    %esp,%ebp
  8003b2:	83 ec 28             	sub    $0x28,%esp
    int cnt = 0;
  8003b5:	c7 45 f0 00 00 00 00 	movl   $0x0,-0x10(%ebp)
    char c;
    while ((c = *str ++) != '\0') {
  8003bc:	eb 13                	jmp    8003d1 <cputs+0x26>
        cputch(c, &cnt);
  8003be:	0f be 45 f7          	movsbl -0x9(%ebp),%eax
  8003c2:	8d 55 f0             	lea    -0x10(%ebp),%edx
  8003c5:	89 54 24 04          	mov    %edx,0x4(%esp)
  8003c9:	89 04 24             	mov    %eax,(%esp)
  8003cc:	e8 54 ff ff ff       	call   800325 <cputch>
    while ((c = *str ++) != '\0') {
  8003d1:	8b 45 08             	mov    0x8(%ebp),%eax
  8003d4:	8d 50 01             	lea    0x1(%eax),%edx
  8003d7:	89 55 08             	mov    %edx,0x8(%ebp)
  8003da:	0f b6 00             	movzbl (%eax),%eax
  8003dd:	88 45 f7             	mov    %al,-0x9(%ebp)
  8003e0:	80 7d f7 00          	cmpb   $0x0,-0x9(%ebp)
  8003e4:	75 d8                	jne    8003be <cputs+0x13>
    }
    cputch('\n', &cnt);
  8003e6:	8d 45 f0             	lea    -0x10(%ebp),%eax
  8003e9:	89 44 24 04          	mov    %eax,0x4(%esp)
  8003ed:	c7 04 24 0a 00 00 00 	movl   $0xa,(%esp)
  8003f4:	e8 2c ff ff ff       	call   800325 <cputch>
    return cnt;
  8003f9:	8b 45 f0             	mov    -0x10(%ebp),%eax
}
  8003fc:	c9                   	leave  
  8003fd:	c3                   	ret    

008003fe <umain>:
#include <ulib.h>

int main(void);

void
umain(void) {
  8003fe:	f3 0f 1e fb          	endbr32 
  800402:	55                   	push   %ebp
  800403:	89 e5                	mov    %esp,%ebp
  800405:	83 ec 28             	sub    $0x28,%esp
    int ret = main();
  800408:	e8 7d 0c 00 00       	call   80108a <main>
  80040d:	89 45 f4             	mov    %eax,-0xc(%ebp)
    exit(ret);
  800410:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800413:	89 04 24             	mov    %eax,(%esp)
  800416:	e8 14 fe ff ff       	call   80022f <exit>

0080041b <strlen>:
 * @s:      the input string
 *
 * The strlen() function returns the length of string @s.
 * */
size_t
strlen(const char *s) {
  80041b:	f3 0f 1e fb          	endbr32 
  80041f:	55                   	push   %ebp
  800420:	89 e5                	mov    %esp,%ebp
  800422:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
  800425:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (*s ++ != '\0') {
  80042c:	eb 03                	jmp    800431 <strlen+0x16>
        cnt ++;
  80042e:	ff 45 fc             	incl   -0x4(%ebp)
    while (*s ++ != '\0') {
  800431:	8b 45 08             	mov    0x8(%ebp),%eax
  800434:	8d 50 01             	lea    0x1(%eax),%edx
  800437:	89 55 08             	mov    %edx,0x8(%ebp)
  80043a:	0f b6 00             	movzbl (%eax),%eax
  80043d:	84 c0                	test   %al,%al
  80043f:	75 ed                	jne    80042e <strlen+0x13>
    }
    return cnt;
  800441:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
  800444:	c9                   	leave  
  800445:	c3                   	ret    

00800446 <strnlen>:
 * The return value is strlen(s), if that is less than @len, or
 * @len if there is no '\0' character among the first @len characters
 * pointed by @s.
 * */
size_t
strnlen(const char *s, size_t len) {
  800446:	f3 0f 1e fb          	endbr32 
  80044a:	55                   	push   %ebp
  80044b:	89 e5                	mov    %esp,%ebp
  80044d:	83 ec 10             	sub    $0x10,%esp
    size_t cnt = 0;
  800450:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
  800457:	eb 03                	jmp    80045c <strnlen+0x16>
        cnt ++;
  800459:	ff 45 fc             	incl   -0x4(%ebp)
    while (cnt < len && *s ++ != '\0') {
  80045c:	8b 45 fc             	mov    -0x4(%ebp),%eax
  80045f:	3b 45 0c             	cmp    0xc(%ebp),%eax
  800462:	73 10                	jae    800474 <strnlen+0x2e>
  800464:	8b 45 08             	mov    0x8(%ebp),%eax
  800467:	8d 50 01             	lea    0x1(%eax),%edx
  80046a:	89 55 08             	mov    %edx,0x8(%ebp)
  80046d:	0f b6 00             	movzbl (%eax),%eax
  800470:	84 c0                	test   %al,%al
  800472:	75 e5                	jne    800459 <strnlen+0x13>
    }
    return cnt;
  800474:	8b 45 fc             	mov    -0x4(%ebp),%eax
}
  800477:	c9                   	leave  
  800478:	c3                   	ret    

00800479 <strcpy>:
 * To avoid overflows, the size of array pointed by @dst should be long enough to
 * contain the same string as @src (including the terminating null character), and
 * should not overlap in memory with @src.
 * */
char *
strcpy(char *dst, const char *src) {
  800479:	f3 0f 1e fb          	endbr32 
  80047d:	55                   	push   %ebp
  80047e:	89 e5                	mov    %esp,%ebp
  800480:	57                   	push   %edi
  800481:	56                   	push   %esi
  800482:	83 ec 20             	sub    $0x20,%esp
  800485:	8b 45 08             	mov    0x8(%ebp),%eax
  800488:	89 45 f4             	mov    %eax,-0xc(%ebp)
  80048b:	8b 45 0c             	mov    0xc(%ebp),%eax
  80048e:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_STRCPY
#define __HAVE_ARCH_STRCPY
static inline char *
__strcpy(char *dst, const char *src) {
    int d0, d1, d2;
    asm volatile (
  800491:	8b 55 f0             	mov    -0x10(%ebp),%edx
  800494:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800497:	89 d1                	mov    %edx,%ecx
  800499:	89 c2                	mov    %eax,%edx
  80049b:	89 ce                	mov    %ecx,%esi
  80049d:	89 d7                	mov    %edx,%edi
  80049f:	ac                   	lods   %ds:(%esi),%al
  8004a0:	aa                   	stos   %al,%es:(%edi)
  8004a1:	84 c0                	test   %al,%al
  8004a3:	75 fa                	jne    80049f <strcpy+0x26>
  8004a5:	89 fa                	mov    %edi,%edx
  8004a7:	89 f1                	mov    %esi,%ecx
  8004a9:	89 4d ec             	mov    %ecx,-0x14(%ebp)
  8004ac:	89 55 e8             	mov    %edx,-0x18(%ebp)
  8004af:	89 45 e4             	mov    %eax,-0x1c(%ebp)
        "stosb;"
        "testb %%al, %%al;"
        "jne 1b;"
        : "=&S" (d0), "=&D" (d1), "=&a" (d2)
        : "0" (src), "1" (dst) : "memory");
    return dst;
  8004b2:	8b 45 f4             	mov    -0xc(%ebp),%eax
    char *p = dst;
    while ((*p ++ = *src ++) != '\0')
        /* nothing */;
    return dst;
#endif /* __HAVE_ARCH_STRCPY */
}
  8004b5:	83 c4 20             	add    $0x20,%esp
  8004b8:	5e                   	pop    %esi
  8004b9:	5f                   	pop    %edi
  8004ba:	5d                   	pop    %ebp
  8004bb:	c3                   	ret    

008004bc <strncpy>:
 * @len:    maximum number of characters to be copied from @src
 *
 * The return value is @dst
 * */
char *
strncpy(char *dst, const char *src, size_t len) {
  8004bc:	f3 0f 1e fb          	endbr32 
  8004c0:	55                   	push   %ebp
  8004c1:	89 e5                	mov    %esp,%ebp
  8004c3:	83 ec 10             	sub    $0x10,%esp
    char *p = dst;
  8004c6:	8b 45 08             	mov    0x8(%ebp),%eax
  8004c9:	89 45 fc             	mov    %eax,-0x4(%ebp)
    while (len > 0) {
  8004cc:	eb 1e                	jmp    8004ec <strncpy+0x30>
        if ((*p = *src) != '\0') {
  8004ce:	8b 45 0c             	mov    0xc(%ebp),%eax
  8004d1:	0f b6 10             	movzbl (%eax),%edx
  8004d4:	8b 45 fc             	mov    -0x4(%ebp),%eax
  8004d7:	88 10                	mov    %dl,(%eax)
  8004d9:	8b 45 fc             	mov    -0x4(%ebp),%eax
  8004dc:	0f b6 00             	movzbl (%eax),%eax
  8004df:	84 c0                	test   %al,%al
  8004e1:	74 03                	je     8004e6 <strncpy+0x2a>
            src ++;
  8004e3:	ff 45 0c             	incl   0xc(%ebp)
        }
        p ++, len --;
  8004e6:	ff 45 fc             	incl   -0x4(%ebp)
  8004e9:	ff 4d 10             	decl   0x10(%ebp)
    while (len > 0) {
  8004ec:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  8004f0:	75 dc                	jne    8004ce <strncpy+0x12>
    }
    return dst;
  8004f2:	8b 45 08             	mov    0x8(%ebp),%eax
}
  8004f5:	c9                   	leave  
  8004f6:	c3                   	ret    

008004f7 <strcmp>:
 * - A value greater than zero indicates that the first character that does
 *   not match has a greater value in @s1 than in @s2;
 * - And a value less than zero indicates the opposite.
 * */
int
strcmp(const char *s1, const char *s2) {
  8004f7:	f3 0f 1e fb          	endbr32 
  8004fb:	55                   	push   %ebp
  8004fc:	89 e5                	mov    %esp,%ebp
  8004fe:	57                   	push   %edi
  8004ff:	56                   	push   %esi
  800500:	83 ec 20             	sub    $0x20,%esp
  800503:	8b 45 08             	mov    0x8(%ebp),%eax
  800506:	89 45 f4             	mov    %eax,-0xc(%ebp)
  800509:	8b 45 0c             	mov    0xc(%ebp),%eax
  80050c:	89 45 f0             	mov    %eax,-0x10(%ebp)
    asm volatile (
  80050f:	8b 55 f4             	mov    -0xc(%ebp),%edx
  800512:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800515:	89 d1                	mov    %edx,%ecx
  800517:	89 c2                	mov    %eax,%edx
  800519:	89 ce                	mov    %ecx,%esi
  80051b:	89 d7                	mov    %edx,%edi
  80051d:	ac                   	lods   %ds:(%esi),%al
  80051e:	ae                   	scas   %es:(%edi),%al
  80051f:	75 08                	jne    800529 <strcmp+0x32>
  800521:	84 c0                	test   %al,%al
  800523:	75 f8                	jne    80051d <strcmp+0x26>
  800525:	31 c0                	xor    %eax,%eax
  800527:	eb 04                	jmp    80052d <strcmp+0x36>
  800529:	19 c0                	sbb    %eax,%eax
  80052b:	0c 01                	or     $0x1,%al
  80052d:	89 fa                	mov    %edi,%edx
  80052f:	89 f1                	mov    %esi,%ecx
  800531:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800534:	89 4d e8             	mov    %ecx,-0x18(%ebp)
  800537:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return ret;
  80053a:	8b 45 ec             	mov    -0x14(%ebp),%eax
    while (*s1 != '\0' && *s1 == *s2) {
        s1 ++, s2 ++;
    }
    return (int)((unsigned char)*s1 - (unsigned char)*s2);
#endif /* __HAVE_ARCH_STRCMP */
}
  80053d:	83 c4 20             	add    $0x20,%esp
  800540:	5e                   	pop    %esi
  800541:	5f                   	pop    %edi
  800542:	5d                   	pop    %ebp
  800543:	c3                   	ret    

00800544 <strncmp>:
 * they are equal to each other, it continues with the following pairs until
 * the characters differ, until a terminating null-character is reached, or
 * until @n characters match in both strings, whichever happens first.
 * */
int
strncmp(const char *s1, const char *s2, size_t n) {
  800544:	f3 0f 1e fb          	endbr32 
  800548:	55                   	push   %ebp
  800549:	89 e5                	mov    %esp,%ebp
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
  80054b:	eb 09                	jmp    800556 <strncmp+0x12>
        n --, s1 ++, s2 ++;
  80054d:	ff 4d 10             	decl   0x10(%ebp)
  800550:	ff 45 08             	incl   0x8(%ebp)
  800553:	ff 45 0c             	incl   0xc(%ebp)
    while (n > 0 && *s1 != '\0' && *s1 == *s2) {
  800556:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  80055a:	74 1a                	je     800576 <strncmp+0x32>
  80055c:	8b 45 08             	mov    0x8(%ebp),%eax
  80055f:	0f b6 00             	movzbl (%eax),%eax
  800562:	84 c0                	test   %al,%al
  800564:	74 10                	je     800576 <strncmp+0x32>
  800566:	8b 45 08             	mov    0x8(%ebp),%eax
  800569:	0f b6 10             	movzbl (%eax),%edx
  80056c:	8b 45 0c             	mov    0xc(%ebp),%eax
  80056f:	0f b6 00             	movzbl (%eax),%eax
  800572:	38 c2                	cmp    %al,%dl
  800574:	74 d7                	je     80054d <strncmp+0x9>
    }
    return (n == 0) ? 0 : (int)((unsigned char)*s1 - (unsigned char)*s2);
  800576:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  80057a:	74 18                	je     800594 <strncmp+0x50>
  80057c:	8b 45 08             	mov    0x8(%ebp),%eax
  80057f:	0f b6 00             	movzbl (%eax),%eax
  800582:	0f b6 d0             	movzbl %al,%edx
  800585:	8b 45 0c             	mov    0xc(%ebp),%eax
  800588:	0f b6 00             	movzbl (%eax),%eax
  80058b:	0f b6 c0             	movzbl %al,%eax
  80058e:	29 c2                	sub    %eax,%edx
  800590:	89 d0                	mov    %edx,%eax
  800592:	eb 05                	jmp    800599 <strncmp+0x55>
  800594:	b8 00 00 00 00       	mov    $0x0,%eax
}
  800599:	5d                   	pop    %ebp
  80059a:	c3                   	ret    

0080059b <strchr>:
 *
 * The strchr() function returns a pointer to the first occurrence of
 * character in @s. If the value is not found, the function returns 'NULL'.
 * */
char *
strchr(const char *s, char c) {
  80059b:	f3 0f 1e fb          	endbr32 
  80059f:	55                   	push   %ebp
  8005a0:	89 e5                	mov    %esp,%ebp
  8005a2:	83 ec 04             	sub    $0x4,%esp
  8005a5:	8b 45 0c             	mov    0xc(%ebp),%eax
  8005a8:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
  8005ab:	eb 13                	jmp    8005c0 <strchr+0x25>
        if (*s == c) {
  8005ad:	8b 45 08             	mov    0x8(%ebp),%eax
  8005b0:	0f b6 00             	movzbl (%eax),%eax
  8005b3:	38 45 fc             	cmp    %al,-0x4(%ebp)
  8005b6:	75 05                	jne    8005bd <strchr+0x22>
            return (char *)s;
  8005b8:	8b 45 08             	mov    0x8(%ebp),%eax
  8005bb:	eb 12                	jmp    8005cf <strchr+0x34>
        }
        s ++;
  8005bd:	ff 45 08             	incl   0x8(%ebp)
    while (*s != '\0') {
  8005c0:	8b 45 08             	mov    0x8(%ebp),%eax
  8005c3:	0f b6 00             	movzbl (%eax),%eax
  8005c6:	84 c0                	test   %al,%al
  8005c8:	75 e3                	jne    8005ad <strchr+0x12>
    }
    return NULL;
  8005ca:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8005cf:	c9                   	leave  
  8005d0:	c3                   	ret    

008005d1 <strfind>:
 * The strfind() function is like strchr() except that if @c is
 * not found in @s, then it returns a pointer to the null byte at the
 * end of @s, rather than 'NULL'.
 * */
char *
strfind(const char *s, char c) {
  8005d1:	f3 0f 1e fb          	endbr32 
  8005d5:	55                   	push   %ebp
  8005d6:	89 e5                	mov    %esp,%ebp
  8005d8:	83 ec 04             	sub    $0x4,%esp
  8005db:	8b 45 0c             	mov    0xc(%ebp),%eax
  8005de:	88 45 fc             	mov    %al,-0x4(%ebp)
    while (*s != '\0') {
  8005e1:	eb 0e                	jmp    8005f1 <strfind+0x20>
        if (*s == c) {
  8005e3:	8b 45 08             	mov    0x8(%ebp),%eax
  8005e6:	0f b6 00             	movzbl (%eax),%eax
  8005e9:	38 45 fc             	cmp    %al,-0x4(%ebp)
  8005ec:	74 0f                	je     8005fd <strfind+0x2c>
            break;
        }
        s ++;
  8005ee:	ff 45 08             	incl   0x8(%ebp)
    while (*s != '\0') {
  8005f1:	8b 45 08             	mov    0x8(%ebp),%eax
  8005f4:	0f b6 00             	movzbl (%eax),%eax
  8005f7:	84 c0                	test   %al,%al
  8005f9:	75 e8                	jne    8005e3 <strfind+0x12>
  8005fb:	eb 01                	jmp    8005fe <strfind+0x2d>
            break;
  8005fd:	90                   	nop
    }
    return (char *)s;
  8005fe:	8b 45 08             	mov    0x8(%ebp),%eax
}
  800601:	c9                   	leave  
  800602:	c3                   	ret    

00800603 <strtol>:
 * an optional "0x" or "0X" prefix.
 *
 * The strtol() function returns the converted integral number as a long int value.
 * */
long
strtol(const char *s, char **endptr, int base) {
  800603:	f3 0f 1e fb          	endbr32 
  800607:	55                   	push   %ebp
  800608:	89 e5                	mov    %esp,%ebp
  80060a:	83 ec 10             	sub    $0x10,%esp
    int neg = 0;
  80060d:	c7 45 fc 00 00 00 00 	movl   $0x0,-0x4(%ebp)
    long val = 0;
  800614:	c7 45 f8 00 00 00 00 	movl   $0x0,-0x8(%ebp)

    // gobble initial whitespace
    while (*s == ' ' || *s == '\t') {
  80061b:	eb 03                	jmp    800620 <strtol+0x1d>
        s ++;
  80061d:	ff 45 08             	incl   0x8(%ebp)
    while (*s == ' ' || *s == '\t') {
  800620:	8b 45 08             	mov    0x8(%ebp),%eax
  800623:	0f b6 00             	movzbl (%eax),%eax
  800626:	3c 20                	cmp    $0x20,%al
  800628:	74 f3                	je     80061d <strtol+0x1a>
  80062a:	8b 45 08             	mov    0x8(%ebp),%eax
  80062d:	0f b6 00             	movzbl (%eax),%eax
  800630:	3c 09                	cmp    $0x9,%al
  800632:	74 e9                	je     80061d <strtol+0x1a>
    }

    // plus/minus sign
    if (*s == '+') {
  800634:	8b 45 08             	mov    0x8(%ebp),%eax
  800637:	0f b6 00             	movzbl (%eax),%eax
  80063a:	3c 2b                	cmp    $0x2b,%al
  80063c:	75 05                	jne    800643 <strtol+0x40>
        s ++;
  80063e:	ff 45 08             	incl   0x8(%ebp)
  800641:	eb 14                	jmp    800657 <strtol+0x54>
    }
    else if (*s == '-') {
  800643:	8b 45 08             	mov    0x8(%ebp),%eax
  800646:	0f b6 00             	movzbl (%eax),%eax
  800649:	3c 2d                	cmp    $0x2d,%al
  80064b:	75 0a                	jne    800657 <strtol+0x54>
        s ++, neg = 1;
  80064d:	ff 45 08             	incl   0x8(%ebp)
  800650:	c7 45 fc 01 00 00 00 	movl   $0x1,-0x4(%ebp)
    }

    // hex or octal base prefix
    if ((base == 0 || base == 16) && (s[0] == '0' && s[1] == 'x')) {
  800657:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  80065b:	74 06                	je     800663 <strtol+0x60>
  80065d:	83 7d 10 10          	cmpl   $0x10,0x10(%ebp)
  800661:	75 22                	jne    800685 <strtol+0x82>
  800663:	8b 45 08             	mov    0x8(%ebp),%eax
  800666:	0f b6 00             	movzbl (%eax),%eax
  800669:	3c 30                	cmp    $0x30,%al
  80066b:	75 18                	jne    800685 <strtol+0x82>
  80066d:	8b 45 08             	mov    0x8(%ebp),%eax
  800670:	40                   	inc    %eax
  800671:	0f b6 00             	movzbl (%eax),%eax
  800674:	3c 78                	cmp    $0x78,%al
  800676:	75 0d                	jne    800685 <strtol+0x82>
        s += 2, base = 16;
  800678:	83 45 08 02          	addl   $0x2,0x8(%ebp)
  80067c:	c7 45 10 10 00 00 00 	movl   $0x10,0x10(%ebp)
  800683:	eb 29                	jmp    8006ae <strtol+0xab>
    }
    else if (base == 0 && s[0] == '0') {
  800685:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  800689:	75 16                	jne    8006a1 <strtol+0x9e>
  80068b:	8b 45 08             	mov    0x8(%ebp),%eax
  80068e:	0f b6 00             	movzbl (%eax),%eax
  800691:	3c 30                	cmp    $0x30,%al
  800693:	75 0c                	jne    8006a1 <strtol+0x9e>
        s ++, base = 8;
  800695:	ff 45 08             	incl   0x8(%ebp)
  800698:	c7 45 10 08 00 00 00 	movl   $0x8,0x10(%ebp)
  80069f:	eb 0d                	jmp    8006ae <strtol+0xab>
    }
    else if (base == 0) {
  8006a1:	83 7d 10 00          	cmpl   $0x0,0x10(%ebp)
  8006a5:	75 07                	jne    8006ae <strtol+0xab>
        base = 10;
  8006a7:	c7 45 10 0a 00 00 00 	movl   $0xa,0x10(%ebp)

    // digits
    while (1) {
        int dig;

        if (*s >= '0' && *s <= '9') {
  8006ae:	8b 45 08             	mov    0x8(%ebp),%eax
  8006b1:	0f b6 00             	movzbl (%eax),%eax
  8006b4:	3c 2f                	cmp    $0x2f,%al
  8006b6:	7e 1b                	jle    8006d3 <strtol+0xd0>
  8006b8:	8b 45 08             	mov    0x8(%ebp),%eax
  8006bb:	0f b6 00             	movzbl (%eax),%eax
  8006be:	3c 39                	cmp    $0x39,%al
  8006c0:	7f 11                	jg     8006d3 <strtol+0xd0>
            dig = *s - '0';
  8006c2:	8b 45 08             	mov    0x8(%ebp),%eax
  8006c5:	0f b6 00             	movzbl (%eax),%eax
  8006c8:	0f be c0             	movsbl %al,%eax
  8006cb:	83 e8 30             	sub    $0x30,%eax
  8006ce:	89 45 f4             	mov    %eax,-0xc(%ebp)
  8006d1:	eb 48                	jmp    80071b <strtol+0x118>
        }
        else if (*s >= 'a' && *s <= 'z') {
  8006d3:	8b 45 08             	mov    0x8(%ebp),%eax
  8006d6:	0f b6 00             	movzbl (%eax),%eax
  8006d9:	3c 60                	cmp    $0x60,%al
  8006db:	7e 1b                	jle    8006f8 <strtol+0xf5>
  8006dd:	8b 45 08             	mov    0x8(%ebp),%eax
  8006e0:	0f b6 00             	movzbl (%eax),%eax
  8006e3:	3c 7a                	cmp    $0x7a,%al
  8006e5:	7f 11                	jg     8006f8 <strtol+0xf5>
            dig = *s - 'a' + 10;
  8006e7:	8b 45 08             	mov    0x8(%ebp),%eax
  8006ea:	0f b6 00             	movzbl (%eax),%eax
  8006ed:	0f be c0             	movsbl %al,%eax
  8006f0:	83 e8 57             	sub    $0x57,%eax
  8006f3:	89 45 f4             	mov    %eax,-0xc(%ebp)
  8006f6:	eb 23                	jmp    80071b <strtol+0x118>
        }
        else if (*s >= 'A' && *s <= 'Z') {
  8006f8:	8b 45 08             	mov    0x8(%ebp),%eax
  8006fb:	0f b6 00             	movzbl (%eax),%eax
  8006fe:	3c 40                	cmp    $0x40,%al
  800700:	7e 3b                	jle    80073d <strtol+0x13a>
  800702:	8b 45 08             	mov    0x8(%ebp),%eax
  800705:	0f b6 00             	movzbl (%eax),%eax
  800708:	3c 5a                	cmp    $0x5a,%al
  80070a:	7f 31                	jg     80073d <strtol+0x13a>
            dig = *s - 'A' + 10;
  80070c:	8b 45 08             	mov    0x8(%ebp),%eax
  80070f:	0f b6 00             	movzbl (%eax),%eax
  800712:	0f be c0             	movsbl %al,%eax
  800715:	83 e8 37             	sub    $0x37,%eax
  800718:	89 45 f4             	mov    %eax,-0xc(%ebp)
        }
        else {
            break;
        }
        if (dig >= base) {
  80071b:	8b 45 f4             	mov    -0xc(%ebp),%eax
  80071e:	3b 45 10             	cmp    0x10(%ebp),%eax
  800721:	7d 19                	jge    80073c <strtol+0x139>
            break;
        }
        s ++, val = (val * base) + dig;
  800723:	ff 45 08             	incl   0x8(%ebp)
  800726:	8b 45 f8             	mov    -0x8(%ebp),%eax
  800729:	0f af 45 10          	imul   0x10(%ebp),%eax
  80072d:	89 c2                	mov    %eax,%edx
  80072f:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800732:	01 d0                	add    %edx,%eax
  800734:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (1) {
  800737:	e9 72 ff ff ff       	jmp    8006ae <strtol+0xab>
            break;
  80073c:	90                   	nop
        // we don't properly detect overflow!
    }

    if (endptr) {
  80073d:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800741:	74 08                	je     80074b <strtol+0x148>
        *endptr = (char *) s;
  800743:	8b 45 0c             	mov    0xc(%ebp),%eax
  800746:	8b 55 08             	mov    0x8(%ebp),%edx
  800749:	89 10                	mov    %edx,(%eax)
    }
    return (neg ? -val : val);
  80074b:	83 7d fc 00          	cmpl   $0x0,-0x4(%ebp)
  80074f:	74 07                	je     800758 <strtol+0x155>
  800751:	8b 45 f8             	mov    -0x8(%ebp),%eax
  800754:	f7 d8                	neg    %eax
  800756:	eb 03                	jmp    80075b <strtol+0x158>
  800758:	8b 45 f8             	mov    -0x8(%ebp),%eax
}
  80075b:	c9                   	leave  
  80075c:	c3                   	ret    

0080075d <memset>:
 * @n:      number of bytes to be set to the value
 *
 * The memset() function returns @s.
 * */
void *
memset(void *s, char c, size_t n) {
  80075d:	f3 0f 1e fb          	endbr32 
  800761:	55                   	push   %ebp
  800762:	89 e5                	mov    %esp,%ebp
  800764:	57                   	push   %edi
  800765:	83 ec 24             	sub    $0x24,%esp
  800768:	8b 45 0c             	mov    0xc(%ebp),%eax
  80076b:	88 45 d8             	mov    %al,-0x28(%ebp)
#ifdef __HAVE_ARCH_MEMSET
    return __memset(s, c, n);
  80076e:	0f be 55 d8          	movsbl -0x28(%ebp),%edx
  800772:	8b 45 08             	mov    0x8(%ebp),%eax
  800775:	89 45 f8             	mov    %eax,-0x8(%ebp)
  800778:	88 55 f7             	mov    %dl,-0x9(%ebp)
  80077b:	8b 45 10             	mov    0x10(%ebp),%eax
  80077e:	89 45 f0             	mov    %eax,-0x10(%ebp)
#ifndef __HAVE_ARCH_MEMSET
#define __HAVE_ARCH_MEMSET
static inline void *
__memset(void *s, char c, size_t n) {
    int d0, d1;
    asm volatile (
  800781:	8b 4d f0             	mov    -0x10(%ebp),%ecx
  800784:	0f b6 45 f7          	movzbl -0x9(%ebp),%eax
  800788:	8b 55 f8             	mov    -0x8(%ebp),%edx
  80078b:	89 d7                	mov    %edx,%edi
  80078d:	f3 aa                	rep stos %al,%es:(%edi)
  80078f:	89 fa                	mov    %edi,%edx
  800791:	89 4d ec             	mov    %ecx,-0x14(%ebp)
  800794:	89 55 e8             	mov    %edx,-0x18(%ebp)
        "rep; stosb;"
        : "=&c" (d0), "=&D" (d1)
        : "0" (n), "a" (c), "1" (s)
        : "memory");
    return s;
  800797:	8b 45 f8             	mov    -0x8(%ebp),%eax
    while (n -- > 0) {
        *p ++ = c;
    }
    return s;
#endif /* __HAVE_ARCH_MEMSET */
}
  80079a:	83 c4 24             	add    $0x24,%esp
  80079d:	5f                   	pop    %edi
  80079e:	5d                   	pop    %ebp
  80079f:	c3                   	ret    

008007a0 <memmove>:
 * @n:      number of bytes to copy
 *
 * The memmove() function returns @dst.
 * */
void *
memmove(void *dst, const void *src, size_t n) {
  8007a0:	f3 0f 1e fb          	endbr32 
  8007a4:	55                   	push   %ebp
  8007a5:	89 e5                	mov    %esp,%ebp
  8007a7:	57                   	push   %edi
  8007a8:	56                   	push   %esi
  8007a9:	53                   	push   %ebx
  8007aa:	83 ec 30             	sub    $0x30,%esp
  8007ad:	8b 45 08             	mov    0x8(%ebp),%eax
  8007b0:	89 45 f0             	mov    %eax,-0x10(%ebp)
  8007b3:	8b 45 0c             	mov    0xc(%ebp),%eax
  8007b6:	89 45 ec             	mov    %eax,-0x14(%ebp)
  8007b9:	8b 45 10             	mov    0x10(%ebp),%eax
  8007bc:	89 45 e8             	mov    %eax,-0x18(%ebp)

#ifndef __HAVE_ARCH_MEMMOVE
#define __HAVE_ARCH_MEMMOVE
static inline void *
__memmove(void *dst, const void *src, size_t n) {
    if (dst < src) {
  8007bf:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8007c2:	3b 45 ec             	cmp    -0x14(%ebp),%eax
  8007c5:	73 42                	jae    800809 <memmove+0x69>
  8007c7:	8b 45 f0             	mov    -0x10(%ebp),%eax
  8007ca:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  8007cd:	8b 45 ec             	mov    -0x14(%ebp),%eax
  8007d0:	89 45 e0             	mov    %eax,-0x20(%ebp)
  8007d3:	8b 45 e8             	mov    -0x18(%ebp),%eax
  8007d6:	89 45 dc             	mov    %eax,-0x24(%ebp)
        "andl $3, %%ecx;"
        "jz 1f;"
        "rep; movsb;"
        "1:"
        : "=&c" (d0), "=&D" (d1), "=&S" (d2)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
  8007d9:	8b 45 dc             	mov    -0x24(%ebp),%eax
  8007dc:	c1 e8 02             	shr    $0x2,%eax
  8007df:	89 c1                	mov    %eax,%ecx
    asm volatile (
  8007e1:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  8007e4:	8b 45 e0             	mov    -0x20(%ebp),%eax
  8007e7:	89 d7                	mov    %edx,%edi
  8007e9:	89 c6                	mov    %eax,%esi
  8007eb:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  8007ed:	8b 4d dc             	mov    -0x24(%ebp),%ecx
  8007f0:	83 e1 03             	and    $0x3,%ecx
  8007f3:	74 02                	je     8007f7 <memmove+0x57>
  8007f5:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
  8007f7:	89 f0                	mov    %esi,%eax
  8007f9:	89 fa                	mov    %edi,%edx
  8007fb:	89 4d d8             	mov    %ecx,-0x28(%ebp)
  8007fe:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  800801:	89 45 d0             	mov    %eax,-0x30(%ebp)
        : "memory");
    return dst;
  800804:	8b 45 e4             	mov    -0x1c(%ebp),%eax
        return __memcpy(dst, src, n);
  800807:	eb 36                	jmp    80083f <memmove+0x9f>
        : "0" (n), "1" (n - 1 + src), "2" (n - 1 + dst)
  800809:	8b 45 e8             	mov    -0x18(%ebp),%eax
  80080c:	8d 50 ff             	lea    -0x1(%eax),%edx
  80080f:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800812:	01 c2                	add    %eax,%edx
  800814:	8b 45 e8             	mov    -0x18(%ebp),%eax
  800817:	8d 48 ff             	lea    -0x1(%eax),%ecx
  80081a:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80081d:	8d 1c 01             	lea    (%ecx,%eax,1),%ebx
    asm volatile (
  800820:	8b 45 e8             	mov    -0x18(%ebp),%eax
  800823:	89 c1                	mov    %eax,%ecx
  800825:	89 d8                	mov    %ebx,%eax
  800827:	89 d6                	mov    %edx,%esi
  800829:	89 c7                	mov    %eax,%edi
  80082b:	fd                   	std    
  80082c:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
  80082e:	fc                   	cld    
  80082f:	89 f8                	mov    %edi,%eax
  800831:	89 f2                	mov    %esi,%edx
  800833:	89 4d cc             	mov    %ecx,-0x34(%ebp)
  800836:	89 55 c8             	mov    %edx,-0x38(%ebp)
  800839:	89 45 c4             	mov    %eax,-0x3c(%ebp)
    return dst;
  80083c:	8b 45 f0             	mov    -0x10(%ebp),%eax
            *d ++ = *s ++;
        }
    }
    return dst;
#endif /* __HAVE_ARCH_MEMMOVE */
}
  80083f:	83 c4 30             	add    $0x30,%esp
  800842:	5b                   	pop    %ebx
  800843:	5e                   	pop    %esi
  800844:	5f                   	pop    %edi
  800845:	5d                   	pop    %ebp
  800846:	c3                   	ret    

00800847 <memcpy>:
 * it always copies exactly @n bytes. To avoid overflows, the size of arrays pointed
 * by both @src and @dst, should be at least @n bytes, and should not overlap
 * (for overlapping memory area, memmove is a safer approach).
 * */
void *
memcpy(void *dst, const void *src, size_t n) {
  800847:	f3 0f 1e fb          	endbr32 
  80084b:	55                   	push   %ebp
  80084c:	89 e5                	mov    %esp,%ebp
  80084e:	57                   	push   %edi
  80084f:	56                   	push   %esi
  800850:	83 ec 20             	sub    $0x20,%esp
  800853:	8b 45 08             	mov    0x8(%ebp),%eax
  800856:	89 45 f4             	mov    %eax,-0xc(%ebp)
  800859:	8b 45 0c             	mov    0xc(%ebp),%eax
  80085c:	89 45 f0             	mov    %eax,-0x10(%ebp)
  80085f:	8b 45 10             	mov    0x10(%ebp),%eax
  800862:	89 45 ec             	mov    %eax,-0x14(%ebp)
        : "0" (n / 4), "g" (n), "1" (dst), "2" (src)
  800865:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800868:	c1 e8 02             	shr    $0x2,%eax
  80086b:	89 c1                	mov    %eax,%ecx
    asm volatile (
  80086d:	8b 55 f4             	mov    -0xc(%ebp),%edx
  800870:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800873:	89 d7                	mov    %edx,%edi
  800875:	89 c6                	mov    %eax,%esi
  800877:	f3 a5                	rep movsl %ds:(%esi),%es:(%edi)
  800879:	8b 4d ec             	mov    -0x14(%ebp),%ecx
  80087c:	83 e1 03             	and    $0x3,%ecx
  80087f:	74 02                	je     800883 <memcpy+0x3c>
  800881:	f3 a4                	rep movsb %ds:(%esi),%es:(%edi)
  800883:	89 f0                	mov    %esi,%eax
  800885:	89 fa                	mov    %edi,%edx
  800887:	89 4d e8             	mov    %ecx,-0x18(%ebp)
  80088a:	89 55 e4             	mov    %edx,-0x1c(%ebp)
  80088d:	89 45 e0             	mov    %eax,-0x20(%ebp)
    return dst;
  800890:	8b 45 f4             	mov    -0xc(%ebp),%eax
    while (n -- > 0) {
        *d ++ = *s ++;
    }
    return dst;
#endif /* __HAVE_ARCH_MEMCPY */
}
  800893:	83 c4 20             	add    $0x20,%esp
  800896:	5e                   	pop    %esi
  800897:	5f                   	pop    %edi
  800898:	5d                   	pop    %ebp
  800899:	c3                   	ret    

0080089a <memcmp>:
 *   match in both memory blocks has a greater value in @v1 than in @v2
 *   as if evaluated as unsigned char values;
 * - And a value less than zero indicates the opposite.
 * */
int
memcmp(const void *v1, const void *v2, size_t n) {
  80089a:	f3 0f 1e fb          	endbr32 
  80089e:	55                   	push   %ebp
  80089f:	89 e5                	mov    %esp,%ebp
  8008a1:	83 ec 10             	sub    $0x10,%esp
    const char *s1 = (const char *)v1;
  8008a4:	8b 45 08             	mov    0x8(%ebp),%eax
  8008a7:	89 45 fc             	mov    %eax,-0x4(%ebp)
    const char *s2 = (const char *)v2;
  8008aa:	8b 45 0c             	mov    0xc(%ebp),%eax
  8008ad:	89 45 f8             	mov    %eax,-0x8(%ebp)
    while (n -- > 0) {
  8008b0:	eb 2e                	jmp    8008e0 <memcmp+0x46>
        if (*s1 != *s2) {
  8008b2:	8b 45 fc             	mov    -0x4(%ebp),%eax
  8008b5:	0f b6 10             	movzbl (%eax),%edx
  8008b8:	8b 45 f8             	mov    -0x8(%ebp),%eax
  8008bb:	0f b6 00             	movzbl (%eax),%eax
  8008be:	38 c2                	cmp    %al,%dl
  8008c0:	74 18                	je     8008da <memcmp+0x40>
            return (int)((unsigned char)*s1 - (unsigned char)*s2);
  8008c2:	8b 45 fc             	mov    -0x4(%ebp),%eax
  8008c5:	0f b6 00             	movzbl (%eax),%eax
  8008c8:	0f b6 d0             	movzbl %al,%edx
  8008cb:	8b 45 f8             	mov    -0x8(%ebp),%eax
  8008ce:	0f b6 00             	movzbl (%eax),%eax
  8008d1:	0f b6 c0             	movzbl %al,%eax
  8008d4:	29 c2                	sub    %eax,%edx
  8008d6:	89 d0                	mov    %edx,%eax
  8008d8:	eb 18                	jmp    8008f2 <memcmp+0x58>
        }
        s1 ++, s2 ++;
  8008da:	ff 45 fc             	incl   -0x4(%ebp)
  8008dd:	ff 45 f8             	incl   -0x8(%ebp)
    while (n -- > 0) {
  8008e0:	8b 45 10             	mov    0x10(%ebp),%eax
  8008e3:	8d 50 ff             	lea    -0x1(%eax),%edx
  8008e6:	89 55 10             	mov    %edx,0x10(%ebp)
  8008e9:	85 c0                	test   %eax,%eax
  8008eb:	75 c5                	jne    8008b2 <memcmp+0x18>
    }
    return 0;
  8008ed:	b8 00 00 00 00       	mov    $0x0,%eax
}
  8008f2:	c9                   	leave  
  8008f3:	c3                   	ret    

008008f4 <printnum>:
 * @width:      maximum number of digits, if the actual width is less than @width, use @padc instead
 * @padc:       character that padded on the left if the actual width is less than @width
 * */
static void
printnum(void (*putch)(int, void*), void *putdat,
        unsigned long long num, unsigned base, int width, int padc) {
  8008f4:	f3 0f 1e fb          	endbr32 
  8008f8:	55                   	push   %ebp
  8008f9:	89 e5                	mov    %esp,%ebp
  8008fb:	83 ec 58             	sub    $0x58,%esp
  8008fe:	8b 45 10             	mov    0x10(%ebp),%eax
  800901:	89 45 d0             	mov    %eax,-0x30(%ebp)
  800904:	8b 45 14             	mov    0x14(%ebp),%eax
  800907:	89 45 d4             	mov    %eax,-0x2c(%ebp)
    unsigned long long result = num;
  80090a:	8b 45 d0             	mov    -0x30(%ebp),%eax
  80090d:	8b 55 d4             	mov    -0x2c(%ebp),%edx
  800910:	89 45 e8             	mov    %eax,-0x18(%ebp)
  800913:	89 55 ec             	mov    %edx,-0x14(%ebp)
    unsigned mod = do_div(result, base);
  800916:	8b 45 18             	mov    0x18(%ebp),%eax
  800919:	89 45 e4             	mov    %eax,-0x1c(%ebp)
  80091c:	8b 45 e8             	mov    -0x18(%ebp),%eax
  80091f:	8b 55 ec             	mov    -0x14(%ebp),%edx
  800922:	89 45 e0             	mov    %eax,-0x20(%ebp)
  800925:	89 55 f0             	mov    %edx,-0x10(%ebp)
  800928:	8b 45 f0             	mov    -0x10(%ebp),%eax
  80092b:	89 45 f4             	mov    %eax,-0xc(%ebp)
  80092e:	83 7d f0 00          	cmpl   $0x0,-0x10(%ebp)
  800932:	74 1c                	je     800950 <printnum+0x5c>
  800934:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800937:	ba 00 00 00 00       	mov    $0x0,%edx
  80093c:	f7 75 e4             	divl   -0x1c(%ebp)
  80093f:	89 55 f4             	mov    %edx,-0xc(%ebp)
  800942:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800945:	ba 00 00 00 00       	mov    $0x0,%edx
  80094a:	f7 75 e4             	divl   -0x1c(%ebp)
  80094d:	89 45 f0             	mov    %eax,-0x10(%ebp)
  800950:	8b 45 e0             	mov    -0x20(%ebp),%eax
  800953:	8b 55 f4             	mov    -0xc(%ebp),%edx
  800956:	f7 75 e4             	divl   -0x1c(%ebp)
  800959:	89 45 e0             	mov    %eax,-0x20(%ebp)
  80095c:	89 55 dc             	mov    %edx,-0x24(%ebp)
  80095f:	8b 45 e0             	mov    -0x20(%ebp),%eax
  800962:	8b 55 f0             	mov    -0x10(%ebp),%edx
  800965:	89 45 e8             	mov    %eax,-0x18(%ebp)
  800968:	89 55 ec             	mov    %edx,-0x14(%ebp)
  80096b:	8b 45 dc             	mov    -0x24(%ebp),%eax
  80096e:	89 45 d8             	mov    %eax,-0x28(%ebp)

    // first recursively print all preceding (more significant) digits
    if (num >= base) {
  800971:	8b 45 18             	mov    0x18(%ebp),%eax
  800974:	ba 00 00 00 00       	mov    $0x0,%edx
  800979:	8b 4d d4             	mov    -0x2c(%ebp),%ecx
  80097c:	39 45 d0             	cmp    %eax,-0x30(%ebp)
  80097f:	19 d1                	sbb    %edx,%ecx
  800981:	72 4c                	jb     8009cf <printnum+0xdb>
        printnum(putch, putdat, result, base, width - 1, padc);
  800983:	8b 45 1c             	mov    0x1c(%ebp),%eax
  800986:	8d 50 ff             	lea    -0x1(%eax),%edx
  800989:	8b 45 20             	mov    0x20(%ebp),%eax
  80098c:	89 44 24 18          	mov    %eax,0x18(%esp)
  800990:	89 54 24 14          	mov    %edx,0x14(%esp)
  800994:	8b 45 18             	mov    0x18(%ebp),%eax
  800997:	89 44 24 10          	mov    %eax,0x10(%esp)
  80099b:	8b 45 e8             	mov    -0x18(%ebp),%eax
  80099e:	8b 55 ec             	mov    -0x14(%ebp),%edx
  8009a1:	89 44 24 08          	mov    %eax,0x8(%esp)
  8009a5:	89 54 24 0c          	mov    %edx,0xc(%esp)
  8009a9:	8b 45 0c             	mov    0xc(%ebp),%eax
  8009ac:	89 44 24 04          	mov    %eax,0x4(%esp)
  8009b0:	8b 45 08             	mov    0x8(%ebp),%eax
  8009b3:	89 04 24             	mov    %eax,(%esp)
  8009b6:	e8 39 ff ff ff       	call   8008f4 <printnum>
  8009bb:	eb 1b                	jmp    8009d8 <printnum+0xe4>
    } else {
        // print any needed pad characters before first digit
        while (-- width > 0)
            putch(padc, putdat);
  8009bd:	8b 45 0c             	mov    0xc(%ebp),%eax
  8009c0:	89 44 24 04          	mov    %eax,0x4(%esp)
  8009c4:	8b 45 20             	mov    0x20(%ebp),%eax
  8009c7:	89 04 24             	mov    %eax,(%esp)
  8009ca:	8b 45 08             	mov    0x8(%ebp),%eax
  8009cd:	ff d0                	call   *%eax
        while (-- width > 0)
  8009cf:	ff 4d 1c             	decl   0x1c(%ebp)
  8009d2:	83 7d 1c 00          	cmpl   $0x0,0x1c(%ebp)
  8009d6:	7f e5                	jg     8009bd <printnum+0xc9>
    }
    // then print this (the least significant) digit
    putch("0123456789abcdef"[mod], putdat);
  8009d8:	8b 45 d8             	mov    -0x28(%ebp),%eax
  8009db:	05 44 12 80 00       	add    $0x801244,%eax
  8009e0:	0f b6 00             	movzbl (%eax),%eax
  8009e3:	0f be c0             	movsbl %al,%eax
  8009e6:	8b 55 0c             	mov    0xc(%ebp),%edx
  8009e9:	89 54 24 04          	mov    %edx,0x4(%esp)
  8009ed:	89 04 24             	mov    %eax,(%esp)
  8009f0:	8b 45 08             	mov    0x8(%ebp),%eax
  8009f3:	ff d0                	call   *%eax
}
  8009f5:	90                   	nop
  8009f6:	c9                   	leave  
  8009f7:	c3                   	ret    

008009f8 <getuint>:
 * getuint - get an unsigned int of various possible sizes from a varargs list
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static unsigned long long
getuint(va_list *ap, int lflag) {
  8009f8:	f3 0f 1e fb          	endbr32 
  8009fc:	55                   	push   %ebp
  8009fd:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
  8009ff:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
  800a03:	7e 14                	jle    800a19 <getuint+0x21>
        return va_arg(*ap, unsigned long long);
  800a05:	8b 45 08             	mov    0x8(%ebp),%eax
  800a08:	8b 00                	mov    (%eax),%eax
  800a0a:	8d 48 08             	lea    0x8(%eax),%ecx
  800a0d:	8b 55 08             	mov    0x8(%ebp),%edx
  800a10:	89 0a                	mov    %ecx,(%edx)
  800a12:	8b 50 04             	mov    0x4(%eax),%edx
  800a15:	8b 00                	mov    (%eax),%eax
  800a17:	eb 30                	jmp    800a49 <getuint+0x51>
    }
    else if (lflag) {
  800a19:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800a1d:	74 16                	je     800a35 <getuint+0x3d>
        return va_arg(*ap, unsigned long);
  800a1f:	8b 45 08             	mov    0x8(%ebp),%eax
  800a22:	8b 00                	mov    (%eax),%eax
  800a24:	8d 48 04             	lea    0x4(%eax),%ecx
  800a27:	8b 55 08             	mov    0x8(%ebp),%edx
  800a2a:	89 0a                	mov    %ecx,(%edx)
  800a2c:	8b 00                	mov    (%eax),%eax
  800a2e:	ba 00 00 00 00       	mov    $0x0,%edx
  800a33:	eb 14                	jmp    800a49 <getuint+0x51>
    }
    else {
        return va_arg(*ap, unsigned int);
  800a35:	8b 45 08             	mov    0x8(%ebp),%eax
  800a38:	8b 00                	mov    (%eax),%eax
  800a3a:	8d 48 04             	lea    0x4(%eax),%ecx
  800a3d:	8b 55 08             	mov    0x8(%ebp),%edx
  800a40:	89 0a                	mov    %ecx,(%edx)
  800a42:	8b 00                	mov    (%eax),%eax
  800a44:	ba 00 00 00 00       	mov    $0x0,%edx
    }
}
  800a49:	5d                   	pop    %ebp
  800a4a:	c3                   	ret    

00800a4b <getint>:
 * getint - same as getuint but signed, we can't use getuint because of sign extension
 * @ap:         a varargs list pointer
 * @lflag:      determines the size of the vararg that @ap points to
 * */
static long long
getint(va_list *ap, int lflag) {
  800a4b:	f3 0f 1e fb          	endbr32 
  800a4f:	55                   	push   %ebp
  800a50:	89 e5                	mov    %esp,%ebp
    if (lflag >= 2) {
  800a52:	83 7d 0c 01          	cmpl   $0x1,0xc(%ebp)
  800a56:	7e 14                	jle    800a6c <getint+0x21>
        return va_arg(*ap, long long);
  800a58:	8b 45 08             	mov    0x8(%ebp),%eax
  800a5b:	8b 00                	mov    (%eax),%eax
  800a5d:	8d 48 08             	lea    0x8(%eax),%ecx
  800a60:	8b 55 08             	mov    0x8(%ebp),%edx
  800a63:	89 0a                	mov    %ecx,(%edx)
  800a65:	8b 50 04             	mov    0x4(%eax),%edx
  800a68:	8b 00                	mov    (%eax),%eax
  800a6a:	eb 28                	jmp    800a94 <getint+0x49>
    }
    else if (lflag) {
  800a6c:	83 7d 0c 00          	cmpl   $0x0,0xc(%ebp)
  800a70:	74 12                	je     800a84 <getint+0x39>
        return va_arg(*ap, long);
  800a72:	8b 45 08             	mov    0x8(%ebp),%eax
  800a75:	8b 00                	mov    (%eax),%eax
  800a77:	8d 48 04             	lea    0x4(%eax),%ecx
  800a7a:	8b 55 08             	mov    0x8(%ebp),%edx
  800a7d:	89 0a                	mov    %ecx,(%edx)
  800a7f:	8b 00                	mov    (%eax),%eax
  800a81:	99                   	cltd   
  800a82:	eb 10                	jmp    800a94 <getint+0x49>
    }
    else {
        return va_arg(*ap, int);
  800a84:	8b 45 08             	mov    0x8(%ebp),%eax
  800a87:	8b 00                	mov    (%eax),%eax
  800a89:	8d 48 04             	lea    0x4(%eax),%ecx
  800a8c:	8b 55 08             	mov    0x8(%ebp),%edx
  800a8f:	89 0a                	mov    %ecx,(%edx)
  800a91:	8b 00                	mov    (%eax),%eax
  800a93:	99                   	cltd   
    }
}
  800a94:	5d                   	pop    %ebp
  800a95:	c3                   	ret    

00800a96 <printfmt>:
 * @putch:      specified putch function, print a single character
 * @putdat:     used by @putch function
 * @fmt:        the format string to use
 * */
void
printfmt(void (*putch)(int, void*), void *putdat, const char *fmt, ...) {
  800a96:	f3 0f 1e fb          	endbr32 
  800a9a:	55                   	push   %ebp
  800a9b:	89 e5                	mov    %esp,%ebp
  800a9d:	83 ec 28             	sub    $0x28,%esp
    va_list ap;

    va_start(ap, fmt);
  800aa0:	8d 45 14             	lea    0x14(%ebp),%eax
  800aa3:	89 45 f4             	mov    %eax,-0xc(%ebp)
    vprintfmt(putch, putdat, fmt, ap);
  800aa6:	8b 45 f4             	mov    -0xc(%ebp),%eax
  800aa9:	89 44 24 0c          	mov    %eax,0xc(%esp)
  800aad:	8b 45 10             	mov    0x10(%ebp),%eax
  800ab0:	89 44 24 08          	mov    %eax,0x8(%esp)
  800ab4:	8b 45 0c             	mov    0xc(%ebp),%eax
  800ab7:	89 44 24 04          	mov    %eax,0x4(%esp)
  800abb:	8b 45 08             	mov    0x8(%ebp),%eax
  800abe:	89 04 24             	mov    %eax,(%esp)
  800ac1:	e8 03 00 00 00       	call   800ac9 <vprintfmt>
    va_end(ap);
}
  800ac6:	90                   	nop
  800ac7:	c9                   	leave  
  800ac8:	c3                   	ret    

00800ac9 <vprintfmt>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want printfmt() instead.
 * */
void
vprintfmt(void (*putch)(int, void*), void *putdat, const char *fmt, va_list ap) {
  800ac9:	f3 0f 1e fb          	endbr32 
  800acd:	55                   	push   %ebp
  800ace:	89 e5                	mov    %esp,%ebp
  800ad0:	56                   	push   %esi
  800ad1:	53                   	push   %ebx
  800ad2:	83 ec 40             	sub    $0x40,%esp
    register int ch, err;
    unsigned long long num;
    int base, width, precision, lflag, altflag;

    while (1) {
        while ((ch = *(unsigned char *)fmt ++) != '%') {
  800ad5:	eb 17                	jmp    800aee <vprintfmt+0x25>
            if (ch == '\0') {
  800ad7:	85 db                	test   %ebx,%ebx
  800ad9:	0f 84 c0 03 00 00    	je     800e9f <vprintfmt+0x3d6>
                return;
            }
            putch(ch, putdat);
  800adf:	8b 45 0c             	mov    0xc(%ebp),%eax
  800ae2:	89 44 24 04          	mov    %eax,0x4(%esp)
  800ae6:	89 1c 24             	mov    %ebx,(%esp)
  800ae9:	8b 45 08             	mov    0x8(%ebp),%eax
  800aec:	ff d0                	call   *%eax
        while ((ch = *(unsigned char *)fmt ++) != '%') {
  800aee:	8b 45 10             	mov    0x10(%ebp),%eax
  800af1:	8d 50 01             	lea    0x1(%eax),%edx
  800af4:	89 55 10             	mov    %edx,0x10(%ebp)
  800af7:	0f b6 00             	movzbl (%eax),%eax
  800afa:	0f b6 d8             	movzbl %al,%ebx
  800afd:	83 fb 25             	cmp    $0x25,%ebx
  800b00:	75 d5                	jne    800ad7 <vprintfmt+0xe>
        }

        // Process a %-escape sequence
        char padc = ' ';
  800b02:	c6 45 db 20          	movb   $0x20,-0x25(%ebp)
        width = precision = -1;
  800b06:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
  800b0d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  800b10:	89 45 e8             	mov    %eax,-0x18(%ebp)
        lflag = altflag = 0;
  800b13:	c7 45 dc 00 00 00 00 	movl   $0x0,-0x24(%ebp)
  800b1a:	8b 45 dc             	mov    -0x24(%ebp),%eax
  800b1d:	89 45 e0             	mov    %eax,-0x20(%ebp)

    reswitch:
        switch (ch = *(unsigned char *)fmt ++) {
  800b20:	8b 45 10             	mov    0x10(%ebp),%eax
  800b23:	8d 50 01             	lea    0x1(%eax),%edx
  800b26:	89 55 10             	mov    %edx,0x10(%ebp)
  800b29:	0f b6 00             	movzbl (%eax),%eax
  800b2c:	0f b6 d8             	movzbl %al,%ebx
  800b2f:	8d 43 dd             	lea    -0x23(%ebx),%eax
  800b32:	83 f8 55             	cmp    $0x55,%eax
  800b35:	0f 87 38 03 00 00    	ja     800e73 <vprintfmt+0x3aa>
  800b3b:	8b 04 85 68 12 80 00 	mov    0x801268(,%eax,4),%eax
  800b42:	3e ff e0             	notrack jmp *%eax

        // flag to pad on the right
        case '-':
            padc = '-';
  800b45:	c6 45 db 2d          	movb   $0x2d,-0x25(%ebp)
            goto reswitch;
  800b49:	eb d5                	jmp    800b20 <vprintfmt+0x57>

        // flag to pad with 0's instead of spaces
        case '0':
            padc = '0';
  800b4b:	c6 45 db 30          	movb   $0x30,-0x25(%ebp)
            goto reswitch;
  800b4f:	eb cf                	jmp    800b20 <vprintfmt+0x57>

        // width field
        case '1' ... '9':
            for (precision = 0; ; ++ fmt) {
  800b51:	c7 45 e4 00 00 00 00 	movl   $0x0,-0x1c(%ebp)
                precision = precision * 10 + ch - '0';
  800b58:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  800b5b:	89 d0                	mov    %edx,%eax
  800b5d:	c1 e0 02             	shl    $0x2,%eax
  800b60:	01 d0                	add    %edx,%eax
  800b62:	01 c0                	add    %eax,%eax
  800b64:	01 d8                	add    %ebx,%eax
  800b66:	83 e8 30             	sub    $0x30,%eax
  800b69:	89 45 e4             	mov    %eax,-0x1c(%ebp)
                ch = *fmt;
  800b6c:	8b 45 10             	mov    0x10(%ebp),%eax
  800b6f:	0f b6 00             	movzbl (%eax),%eax
  800b72:	0f be d8             	movsbl %al,%ebx
                if (ch < '0' || ch > '9') {
  800b75:	83 fb 2f             	cmp    $0x2f,%ebx
  800b78:	7e 38                	jle    800bb2 <vprintfmt+0xe9>
  800b7a:	83 fb 39             	cmp    $0x39,%ebx
  800b7d:	7f 33                	jg     800bb2 <vprintfmt+0xe9>
            for (precision = 0; ; ++ fmt) {
  800b7f:	ff 45 10             	incl   0x10(%ebp)
                precision = precision * 10 + ch - '0';
  800b82:	eb d4                	jmp    800b58 <vprintfmt+0x8f>
                }
            }
            goto process_precision;

        case '*':
            precision = va_arg(ap, int);
  800b84:	8b 45 14             	mov    0x14(%ebp),%eax
  800b87:	8d 50 04             	lea    0x4(%eax),%edx
  800b8a:	89 55 14             	mov    %edx,0x14(%ebp)
  800b8d:	8b 00                	mov    (%eax),%eax
  800b8f:	89 45 e4             	mov    %eax,-0x1c(%ebp)
            goto process_precision;
  800b92:	eb 1f                	jmp    800bb3 <vprintfmt+0xea>

        case '.':
            if (width < 0)
  800b94:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  800b98:	79 86                	jns    800b20 <vprintfmt+0x57>
                width = 0;
  800b9a:	c7 45 e8 00 00 00 00 	movl   $0x0,-0x18(%ebp)
            goto reswitch;
  800ba1:	e9 7a ff ff ff       	jmp    800b20 <vprintfmt+0x57>

        case '#':
            altflag = 1;
  800ba6:	c7 45 dc 01 00 00 00 	movl   $0x1,-0x24(%ebp)
            goto reswitch;
  800bad:	e9 6e ff ff ff       	jmp    800b20 <vprintfmt+0x57>
            goto process_precision;
  800bb2:	90                   	nop

        process_precision:
            if (width < 0)
  800bb3:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  800bb7:	0f 89 63 ff ff ff    	jns    800b20 <vprintfmt+0x57>
                width = precision, precision = -1;
  800bbd:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  800bc0:	89 45 e8             	mov    %eax,-0x18(%ebp)
  800bc3:	c7 45 e4 ff ff ff ff 	movl   $0xffffffff,-0x1c(%ebp)
            goto reswitch;
  800bca:	e9 51 ff ff ff       	jmp    800b20 <vprintfmt+0x57>

        // long flag (doubled for long long)
        case 'l':
            lflag ++;
  800bcf:	ff 45 e0             	incl   -0x20(%ebp)
            goto reswitch;
  800bd2:	e9 49 ff ff ff       	jmp    800b20 <vprintfmt+0x57>

        // character
        case 'c':
            putch(va_arg(ap, int), putdat);
  800bd7:	8b 45 14             	mov    0x14(%ebp),%eax
  800bda:	8d 50 04             	lea    0x4(%eax),%edx
  800bdd:	89 55 14             	mov    %edx,0x14(%ebp)
  800be0:	8b 00                	mov    (%eax),%eax
  800be2:	8b 55 0c             	mov    0xc(%ebp),%edx
  800be5:	89 54 24 04          	mov    %edx,0x4(%esp)
  800be9:	89 04 24             	mov    %eax,(%esp)
  800bec:	8b 45 08             	mov    0x8(%ebp),%eax
  800bef:	ff d0                	call   *%eax
            break;
  800bf1:	e9 a4 02 00 00       	jmp    800e9a <vprintfmt+0x3d1>

        // error message
        case 'e':
            err = va_arg(ap, int);
  800bf6:	8b 45 14             	mov    0x14(%ebp),%eax
  800bf9:	8d 50 04             	lea    0x4(%eax),%edx
  800bfc:	89 55 14             	mov    %edx,0x14(%ebp)
  800bff:	8b 18                	mov    (%eax),%ebx
            if (err < 0) {
  800c01:	85 db                	test   %ebx,%ebx
  800c03:	79 02                	jns    800c07 <vprintfmt+0x13e>
                err = -err;
  800c05:	f7 db                	neg    %ebx
            }
            if (err > MAXERROR || (p = error_string[err]) == NULL) {
  800c07:	83 fb 18             	cmp    $0x18,%ebx
  800c0a:	7f 0b                	jg     800c17 <vprintfmt+0x14e>
  800c0c:	8b 34 9d e0 11 80 00 	mov    0x8011e0(,%ebx,4),%esi
  800c13:	85 f6                	test   %esi,%esi
  800c15:	75 23                	jne    800c3a <vprintfmt+0x171>
                printfmt(putch, putdat, "error %d", err);
  800c17:	89 5c 24 0c          	mov    %ebx,0xc(%esp)
  800c1b:	c7 44 24 08 55 12 80 	movl   $0x801255,0x8(%esp)
  800c22:	00 
  800c23:	8b 45 0c             	mov    0xc(%ebp),%eax
  800c26:	89 44 24 04          	mov    %eax,0x4(%esp)
  800c2a:	8b 45 08             	mov    0x8(%ebp),%eax
  800c2d:	89 04 24             	mov    %eax,(%esp)
  800c30:	e8 61 fe ff ff       	call   800a96 <printfmt>
            }
            else {
                printfmt(putch, putdat, "%s", p);
            }
            break;
  800c35:	e9 60 02 00 00       	jmp    800e9a <vprintfmt+0x3d1>
                printfmt(putch, putdat, "%s", p);
  800c3a:	89 74 24 0c          	mov    %esi,0xc(%esp)
  800c3e:	c7 44 24 08 5e 12 80 	movl   $0x80125e,0x8(%esp)
  800c45:	00 
  800c46:	8b 45 0c             	mov    0xc(%ebp),%eax
  800c49:	89 44 24 04          	mov    %eax,0x4(%esp)
  800c4d:	8b 45 08             	mov    0x8(%ebp),%eax
  800c50:	89 04 24             	mov    %eax,(%esp)
  800c53:	e8 3e fe ff ff       	call   800a96 <printfmt>
            break;
  800c58:	e9 3d 02 00 00       	jmp    800e9a <vprintfmt+0x3d1>

        // string
        case 's':
            if ((p = va_arg(ap, char *)) == NULL) {
  800c5d:	8b 45 14             	mov    0x14(%ebp),%eax
  800c60:	8d 50 04             	lea    0x4(%eax),%edx
  800c63:	89 55 14             	mov    %edx,0x14(%ebp)
  800c66:	8b 30                	mov    (%eax),%esi
  800c68:	85 f6                	test   %esi,%esi
  800c6a:	75 05                	jne    800c71 <vprintfmt+0x1a8>
                p = "(null)";
  800c6c:	be 61 12 80 00       	mov    $0x801261,%esi
            }
            if (width > 0 && padc != '-') {
  800c71:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  800c75:	7e 76                	jle    800ced <vprintfmt+0x224>
  800c77:	80 7d db 2d          	cmpb   $0x2d,-0x25(%ebp)
  800c7b:	74 70                	je     800ced <vprintfmt+0x224>
                for (width -= strnlen(p, precision); width > 0; width --) {
  800c7d:	8b 45 e4             	mov    -0x1c(%ebp),%eax
  800c80:	89 44 24 04          	mov    %eax,0x4(%esp)
  800c84:	89 34 24             	mov    %esi,(%esp)
  800c87:	e8 ba f7 ff ff       	call   800446 <strnlen>
  800c8c:	8b 55 e8             	mov    -0x18(%ebp),%edx
  800c8f:	29 c2                	sub    %eax,%edx
  800c91:	89 d0                	mov    %edx,%eax
  800c93:	89 45 e8             	mov    %eax,-0x18(%ebp)
  800c96:	eb 16                	jmp    800cae <vprintfmt+0x1e5>
                    putch(padc, putdat);
  800c98:	0f be 45 db          	movsbl -0x25(%ebp),%eax
  800c9c:	8b 55 0c             	mov    0xc(%ebp),%edx
  800c9f:	89 54 24 04          	mov    %edx,0x4(%esp)
  800ca3:	89 04 24             	mov    %eax,(%esp)
  800ca6:	8b 45 08             	mov    0x8(%ebp),%eax
  800ca9:	ff d0                	call   *%eax
                for (width -= strnlen(p, precision); width > 0; width --) {
  800cab:	ff 4d e8             	decl   -0x18(%ebp)
  800cae:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  800cb2:	7f e4                	jg     800c98 <vprintfmt+0x1cf>
                }
            }
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
  800cb4:	eb 37                	jmp    800ced <vprintfmt+0x224>
                if (altflag && (ch < ' ' || ch > '~')) {
  800cb6:	83 7d dc 00          	cmpl   $0x0,-0x24(%ebp)
  800cba:	74 1f                	je     800cdb <vprintfmt+0x212>
  800cbc:	83 fb 1f             	cmp    $0x1f,%ebx
  800cbf:	7e 05                	jle    800cc6 <vprintfmt+0x1fd>
  800cc1:	83 fb 7e             	cmp    $0x7e,%ebx
  800cc4:	7e 15                	jle    800cdb <vprintfmt+0x212>
                    putch('?', putdat);
  800cc6:	8b 45 0c             	mov    0xc(%ebp),%eax
  800cc9:	89 44 24 04          	mov    %eax,0x4(%esp)
  800ccd:	c7 04 24 3f 00 00 00 	movl   $0x3f,(%esp)
  800cd4:	8b 45 08             	mov    0x8(%ebp),%eax
  800cd7:	ff d0                	call   *%eax
  800cd9:	eb 0f                	jmp    800cea <vprintfmt+0x221>
                }
                else {
                    putch(ch, putdat);
  800cdb:	8b 45 0c             	mov    0xc(%ebp),%eax
  800cde:	89 44 24 04          	mov    %eax,0x4(%esp)
  800ce2:	89 1c 24             	mov    %ebx,(%esp)
  800ce5:	8b 45 08             	mov    0x8(%ebp),%eax
  800ce8:	ff d0                	call   *%eax
            for (; (ch = *p ++) != '\0' && (precision < 0 || -- precision >= 0); width --) {
  800cea:	ff 4d e8             	decl   -0x18(%ebp)
  800ced:	89 f0                	mov    %esi,%eax
  800cef:	8d 70 01             	lea    0x1(%eax),%esi
  800cf2:	0f b6 00             	movzbl (%eax),%eax
  800cf5:	0f be d8             	movsbl %al,%ebx
  800cf8:	85 db                	test   %ebx,%ebx
  800cfa:	74 27                	je     800d23 <vprintfmt+0x25a>
  800cfc:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  800d00:	78 b4                	js     800cb6 <vprintfmt+0x1ed>
  800d02:	ff 4d e4             	decl   -0x1c(%ebp)
  800d05:	83 7d e4 00          	cmpl   $0x0,-0x1c(%ebp)
  800d09:	79 ab                	jns    800cb6 <vprintfmt+0x1ed>
                }
            }
            for (; width > 0; width --) {
  800d0b:	eb 16                	jmp    800d23 <vprintfmt+0x25a>
                putch(' ', putdat);
  800d0d:	8b 45 0c             	mov    0xc(%ebp),%eax
  800d10:	89 44 24 04          	mov    %eax,0x4(%esp)
  800d14:	c7 04 24 20 00 00 00 	movl   $0x20,(%esp)
  800d1b:	8b 45 08             	mov    0x8(%ebp),%eax
  800d1e:	ff d0                	call   *%eax
            for (; width > 0; width --) {
  800d20:	ff 4d e8             	decl   -0x18(%ebp)
  800d23:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  800d27:	7f e4                	jg     800d0d <vprintfmt+0x244>
            }
            break;
  800d29:	e9 6c 01 00 00       	jmp    800e9a <vprintfmt+0x3d1>

        // (signed) decimal
        case 'd':
            num = getint(&ap, lflag);
  800d2e:	8b 45 e0             	mov    -0x20(%ebp),%eax
  800d31:	89 44 24 04          	mov    %eax,0x4(%esp)
  800d35:	8d 45 14             	lea    0x14(%ebp),%eax
  800d38:	89 04 24             	mov    %eax,(%esp)
  800d3b:	e8 0b fd ff ff       	call   800a4b <getint>
  800d40:	89 45 f0             	mov    %eax,-0x10(%ebp)
  800d43:	89 55 f4             	mov    %edx,-0xc(%ebp)
            if ((long long)num < 0) {
  800d46:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800d49:	8b 55 f4             	mov    -0xc(%ebp),%edx
  800d4c:	85 d2                	test   %edx,%edx
  800d4e:	79 26                	jns    800d76 <vprintfmt+0x2ad>
                putch('-', putdat);
  800d50:	8b 45 0c             	mov    0xc(%ebp),%eax
  800d53:	89 44 24 04          	mov    %eax,0x4(%esp)
  800d57:	c7 04 24 2d 00 00 00 	movl   $0x2d,(%esp)
  800d5e:	8b 45 08             	mov    0x8(%ebp),%eax
  800d61:	ff d0                	call   *%eax
                num = -(long long)num;
  800d63:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800d66:	8b 55 f4             	mov    -0xc(%ebp),%edx
  800d69:	f7 d8                	neg    %eax
  800d6b:	83 d2 00             	adc    $0x0,%edx
  800d6e:	f7 da                	neg    %edx
  800d70:	89 45 f0             	mov    %eax,-0x10(%ebp)
  800d73:	89 55 f4             	mov    %edx,-0xc(%ebp)
            }
            base = 10;
  800d76:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
  800d7d:	e9 a8 00 00 00       	jmp    800e2a <vprintfmt+0x361>

        // unsigned decimal
        case 'u':
            num = getuint(&ap, lflag);
  800d82:	8b 45 e0             	mov    -0x20(%ebp),%eax
  800d85:	89 44 24 04          	mov    %eax,0x4(%esp)
  800d89:	8d 45 14             	lea    0x14(%ebp),%eax
  800d8c:	89 04 24             	mov    %eax,(%esp)
  800d8f:	e8 64 fc ff ff       	call   8009f8 <getuint>
  800d94:	89 45 f0             	mov    %eax,-0x10(%ebp)
  800d97:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 10;
  800d9a:	c7 45 ec 0a 00 00 00 	movl   $0xa,-0x14(%ebp)
            goto number;
  800da1:	e9 84 00 00 00       	jmp    800e2a <vprintfmt+0x361>

        // (unsigned) octal
        case 'o':
            num = getuint(&ap, lflag);
  800da6:	8b 45 e0             	mov    -0x20(%ebp),%eax
  800da9:	89 44 24 04          	mov    %eax,0x4(%esp)
  800dad:	8d 45 14             	lea    0x14(%ebp),%eax
  800db0:	89 04 24             	mov    %eax,(%esp)
  800db3:	e8 40 fc ff ff       	call   8009f8 <getuint>
  800db8:	89 45 f0             	mov    %eax,-0x10(%ebp)
  800dbb:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 8;
  800dbe:	c7 45 ec 08 00 00 00 	movl   $0x8,-0x14(%ebp)
            goto number;
  800dc5:	eb 63                	jmp    800e2a <vprintfmt+0x361>

        // pointer
        case 'p':
            putch('0', putdat);
  800dc7:	8b 45 0c             	mov    0xc(%ebp),%eax
  800dca:	89 44 24 04          	mov    %eax,0x4(%esp)
  800dce:	c7 04 24 30 00 00 00 	movl   $0x30,(%esp)
  800dd5:	8b 45 08             	mov    0x8(%ebp),%eax
  800dd8:	ff d0                	call   *%eax
            putch('x', putdat);
  800dda:	8b 45 0c             	mov    0xc(%ebp),%eax
  800ddd:	89 44 24 04          	mov    %eax,0x4(%esp)
  800de1:	c7 04 24 78 00 00 00 	movl   $0x78,(%esp)
  800de8:	8b 45 08             	mov    0x8(%ebp),%eax
  800deb:	ff d0                	call   *%eax
            num = (unsigned long long)(uintptr_t)va_arg(ap, void *);
  800ded:	8b 45 14             	mov    0x14(%ebp),%eax
  800df0:	8d 50 04             	lea    0x4(%eax),%edx
  800df3:	89 55 14             	mov    %edx,0x14(%ebp)
  800df6:	8b 00                	mov    (%eax),%eax
  800df8:	89 45 f0             	mov    %eax,-0x10(%ebp)
  800dfb:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
            base = 16;
  800e02:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
            goto number;
  800e09:	eb 1f                	jmp    800e2a <vprintfmt+0x361>

        // (unsigned) hexadecimal
        case 'x':
            num = getuint(&ap, lflag);
  800e0b:	8b 45 e0             	mov    -0x20(%ebp),%eax
  800e0e:	89 44 24 04          	mov    %eax,0x4(%esp)
  800e12:	8d 45 14             	lea    0x14(%ebp),%eax
  800e15:	89 04 24             	mov    %eax,(%esp)
  800e18:	e8 db fb ff ff       	call   8009f8 <getuint>
  800e1d:	89 45 f0             	mov    %eax,-0x10(%ebp)
  800e20:	89 55 f4             	mov    %edx,-0xc(%ebp)
            base = 16;
  800e23:	c7 45 ec 10 00 00 00 	movl   $0x10,-0x14(%ebp)
        number:
            printnum(putch, putdat, num, base, width, padc);
  800e2a:	0f be 55 db          	movsbl -0x25(%ebp),%edx
  800e2e:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800e31:	89 54 24 18          	mov    %edx,0x18(%esp)
  800e35:	8b 55 e8             	mov    -0x18(%ebp),%edx
  800e38:	89 54 24 14          	mov    %edx,0x14(%esp)
  800e3c:	89 44 24 10          	mov    %eax,0x10(%esp)
  800e40:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800e43:	8b 55 f4             	mov    -0xc(%ebp),%edx
  800e46:	89 44 24 08          	mov    %eax,0x8(%esp)
  800e4a:	89 54 24 0c          	mov    %edx,0xc(%esp)
  800e4e:	8b 45 0c             	mov    0xc(%ebp),%eax
  800e51:	89 44 24 04          	mov    %eax,0x4(%esp)
  800e55:	8b 45 08             	mov    0x8(%ebp),%eax
  800e58:	89 04 24             	mov    %eax,(%esp)
  800e5b:	e8 94 fa ff ff       	call   8008f4 <printnum>
            break;
  800e60:	eb 38                	jmp    800e9a <vprintfmt+0x3d1>

        // escaped '%' character
        case '%':
            putch(ch, putdat);
  800e62:	8b 45 0c             	mov    0xc(%ebp),%eax
  800e65:	89 44 24 04          	mov    %eax,0x4(%esp)
  800e69:	89 1c 24             	mov    %ebx,(%esp)
  800e6c:	8b 45 08             	mov    0x8(%ebp),%eax
  800e6f:	ff d0                	call   *%eax
            break;
  800e71:	eb 27                	jmp    800e9a <vprintfmt+0x3d1>

        // unrecognized escape sequence - just print it literally
        default:
            putch('%', putdat);
  800e73:	8b 45 0c             	mov    0xc(%ebp),%eax
  800e76:	89 44 24 04          	mov    %eax,0x4(%esp)
  800e7a:	c7 04 24 25 00 00 00 	movl   $0x25,(%esp)
  800e81:	8b 45 08             	mov    0x8(%ebp),%eax
  800e84:	ff d0                	call   *%eax
            for (fmt --; fmt[-1] != '%'; fmt --)
  800e86:	ff 4d 10             	decl   0x10(%ebp)
  800e89:	eb 03                	jmp    800e8e <vprintfmt+0x3c5>
  800e8b:	ff 4d 10             	decl   0x10(%ebp)
  800e8e:	8b 45 10             	mov    0x10(%ebp),%eax
  800e91:	48                   	dec    %eax
  800e92:	0f b6 00             	movzbl (%eax),%eax
  800e95:	3c 25                	cmp    $0x25,%al
  800e97:	75 f2                	jne    800e8b <vprintfmt+0x3c2>
                /* do nothing */;
            break;
  800e99:	90                   	nop
    while (1) {
  800e9a:	e9 36 fc ff ff       	jmp    800ad5 <vprintfmt+0xc>
                return;
  800e9f:	90                   	nop
        }
    }
}
  800ea0:	83 c4 40             	add    $0x40,%esp
  800ea3:	5b                   	pop    %ebx
  800ea4:	5e                   	pop    %esi
  800ea5:	5d                   	pop    %ebp
  800ea6:	c3                   	ret    

00800ea7 <sprintputch>:
 * sprintputch - 'print' a single character in a buffer
 * @ch:         the character will be printed
 * @b:          the buffer to place the character @ch
 * */
static void
sprintputch(int ch, struct sprintbuf *b) {
  800ea7:	f3 0f 1e fb          	endbr32 
  800eab:	55                   	push   %ebp
  800eac:	89 e5                	mov    %esp,%ebp
    b->cnt ++;
  800eae:	8b 45 0c             	mov    0xc(%ebp),%eax
  800eb1:	8b 40 08             	mov    0x8(%eax),%eax
  800eb4:	8d 50 01             	lea    0x1(%eax),%edx
  800eb7:	8b 45 0c             	mov    0xc(%ebp),%eax
  800eba:	89 50 08             	mov    %edx,0x8(%eax)
    if (b->buf < b->ebuf) {
  800ebd:	8b 45 0c             	mov    0xc(%ebp),%eax
  800ec0:	8b 10                	mov    (%eax),%edx
  800ec2:	8b 45 0c             	mov    0xc(%ebp),%eax
  800ec5:	8b 40 04             	mov    0x4(%eax),%eax
  800ec8:	39 c2                	cmp    %eax,%edx
  800eca:	73 12                	jae    800ede <sprintputch+0x37>
        *b->buf ++ = ch;
  800ecc:	8b 45 0c             	mov    0xc(%ebp),%eax
  800ecf:	8b 00                	mov    (%eax),%eax
  800ed1:	8d 48 01             	lea    0x1(%eax),%ecx
  800ed4:	8b 55 0c             	mov    0xc(%ebp),%edx
  800ed7:	89 0a                	mov    %ecx,(%edx)
  800ed9:	8b 55 08             	mov    0x8(%ebp),%edx
  800edc:	88 10                	mov    %dl,(%eax)
    }
}
  800ede:	90                   	nop
  800edf:	5d                   	pop    %ebp
  800ee0:	c3                   	ret    

00800ee1 <snprintf>:
 * @str:        the buffer to place the result into
 * @size:       the size of buffer, including the trailing null space
 * @fmt:        the format string to use
 * */
int
snprintf(char *str, size_t size, const char *fmt, ...) {
  800ee1:	f3 0f 1e fb          	endbr32 
  800ee5:	55                   	push   %ebp
  800ee6:	89 e5                	mov    %esp,%ebp
  800ee8:	83 ec 28             	sub    $0x28,%esp
    va_list ap;
    int cnt;
    va_start(ap, fmt);
  800eeb:	8d 45 14             	lea    0x14(%ebp),%eax
  800eee:	89 45 f0             	mov    %eax,-0x10(%ebp)
    cnt = vsnprintf(str, size, fmt, ap);
  800ef1:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800ef4:	89 44 24 0c          	mov    %eax,0xc(%esp)
  800ef8:	8b 45 10             	mov    0x10(%ebp),%eax
  800efb:	89 44 24 08          	mov    %eax,0x8(%esp)
  800eff:	8b 45 0c             	mov    0xc(%ebp),%eax
  800f02:	89 44 24 04          	mov    %eax,0x4(%esp)
  800f06:	8b 45 08             	mov    0x8(%ebp),%eax
  800f09:	89 04 24             	mov    %eax,(%esp)
  800f0c:	e8 08 00 00 00       	call   800f19 <vsnprintf>
  800f11:	89 45 f4             	mov    %eax,-0xc(%ebp)
    va_end(ap);
    return cnt;
  800f14:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  800f17:	c9                   	leave  
  800f18:	c3                   	ret    

00800f19 <vsnprintf>:
 *
 * Call this function if you are already dealing with a va_list.
 * Or you probably want snprintf() instead.
 * */
int
vsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
  800f19:	f3 0f 1e fb          	endbr32 
  800f1d:	55                   	push   %ebp
  800f1e:	89 e5                	mov    %esp,%ebp
  800f20:	83 ec 28             	sub    $0x28,%esp
    struct sprintbuf b = {str, str + size - 1, 0};
  800f23:	8b 45 08             	mov    0x8(%ebp),%eax
  800f26:	89 45 ec             	mov    %eax,-0x14(%ebp)
  800f29:	8b 45 0c             	mov    0xc(%ebp),%eax
  800f2c:	8d 50 ff             	lea    -0x1(%eax),%edx
  800f2f:	8b 45 08             	mov    0x8(%ebp),%eax
  800f32:	01 d0                	add    %edx,%eax
  800f34:	89 45 f0             	mov    %eax,-0x10(%ebp)
  800f37:	c7 45 f4 00 00 00 00 	movl   $0x0,-0xc(%ebp)
    if (str == NULL || b.buf > b.ebuf) {
  800f3e:	83 7d 08 00          	cmpl   $0x0,0x8(%ebp)
  800f42:	74 0a                	je     800f4e <vsnprintf+0x35>
  800f44:	8b 55 ec             	mov    -0x14(%ebp),%edx
  800f47:	8b 45 f0             	mov    -0x10(%ebp),%eax
  800f4a:	39 c2                	cmp    %eax,%edx
  800f4c:	76 07                	jbe    800f55 <vsnprintf+0x3c>
        return -E_INVAL;
  800f4e:	b8 fd ff ff ff       	mov    $0xfffffffd,%eax
  800f53:	eb 2a                	jmp    800f7f <vsnprintf+0x66>
    }
    // print the string to the buffer
    vprintfmt((void*)sprintputch, &b, fmt, ap);
  800f55:	8b 45 14             	mov    0x14(%ebp),%eax
  800f58:	89 44 24 0c          	mov    %eax,0xc(%esp)
  800f5c:	8b 45 10             	mov    0x10(%ebp),%eax
  800f5f:	89 44 24 08          	mov    %eax,0x8(%esp)
  800f63:	8d 45 ec             	lea    -0x14(%ebp),%eax
  800f66:	89 44 24 04          	mov    %eax,0x4(%esp)
  800f6a:	c7 04 24 a7 0e 80 00 	movl   $0x800ea7,(%esp)
  800f71:	e8 53 fb ff ff       	call   800ac9 <vprintfmt>
    // null terminate the buffer
    *b.buf = '\0';
  800f76:	8b 45 ec             	mov    -0x14(%ebp),%eax
  800f79:	c6 00 00             	movb   $0x0,(%eax)
    return b.cnt;
  800f7c:	8b 45 f4             	mov    -0xc(%ebp),%eax
}
  800f7f:	c9                   	leave  
  800f80:	c3                   	ret    

00800f81 <hash32>:
 * @bits:   the number of bits in a return value
 *
 * High bits are more random, so we use them.
 * */
uint32_t
hash32(uint32_t val, unsigned int bits) {
  800f81:	f3 0f 1e fb          	endbr32 
  800f85:	55                   	push   %ebp
  800f86:	89 e5                	mov    %esp,%ebp
  800f88:	83 ec 10             	sub    $0x10,%esp
    uint32_t hash = val * GOLDEN_RATIO_PRIME_32;
  800f8b:	8b 45 08             	mov    0x8(%ebp),%eax
  800f8e:	69 c0 01 00 37 9e    	imul   $0x9e370001,%eax,%eax
  800f94:	89 45 fc             	mov    %eax,-0x4(%ebp)
    return (hash >> (32 - bits));
  800f97:	b8 20 00 00 00       	mov    $0x20,%eax
  800f9c:	2b 45 0c             	sub    0xc(%ebp),%eax
  800f9f:	8b 55 fc             	mov    -0x4(%ebp),%edx
  800fa2:	88 c1                	mov    %al,%cl
  800fa4:	d3 ea                	shr    %cl,%edx
  800fa6:	89 d0                	mov    %edx,%eax
}
  800fa8:	c9                   	leave  
  800fa9:	c3                   	ret    

00800faa <rand>:
 * rand - returns a pseudo-random integer
 *
 * The rand() function return a value in the range [0, RAND_MAX].
 * */
int
rand(void) {
  800faa:	f3 0f 1e fb          	endbr32 
  800fae:	55                   	push   %ebp
  800faf:	89 e5                	mov    %esp,%ebp
  800fb1:	57                   	push   %edi
  800fb2:	56                   	push   %esi
  800fb3:	53                   	push   %ebx
  800fb4:	83 ec 24             	sub    $0x24,%esp
    next = (next * 0x5DEECE66DLL + 0xBLL) & ((1LL << 48) - 1);
  800fb7:	a1 00 20 80 00       	mov    0x802000,%eax
  800fbc:	8b 15 04 20 80 00    	mov    0x802004,%edx
  800fc2:	69 fa 6d e6 ec de    	imul   $0xdeece66d,%edx,%edi
  800fc8:	6b f0 05             	imul   $0x5,%eax,%esi
  800fcb:	01 fe                	add    %edi,%esi
  800fcd:	bf 6d e6 ec de       	mov    $0xdeece66d,%edi
  800fd2:	f7 e7                	mul    %edi
  800fd4:	01 d6                	add    %edx,%esi
  800fd6:	89 f2                	mov    %esi,%edx
  800fd8:	83 c0 0b             	add    $0xb,%eax
  800fdb:	83 d2 00             	adc    $0x0,%edx
  800fde:	89 c7                	mov    %eax,%edi
  800fe0:	83 e7 ff             	and    $0xffffffff,%edi
  800fe3:	89 f9                	mov    %edi,%ecx
  800fe5:	0f b7 da             	movzwl %dx,%ebx
  800fe8:	89 0d 00 20 80 00    	mov    %ecx,0x802000
  800fee:	89 1d 04 20 80 00    	mov    %ebx,0x802004
    unsigned long long result = (next >> 12);
  800ff4:	a1 00 20 80 00       	mov    0x802000,%eax
  800ff9:	8b 15 04 20 80 00    	mov    0x802004,%edx
  800fff:	0f ac d0 0c          	shrd   $0xc,%edx,%eax
  801003:	c1 ea 0c             	shr    $0xc,%edx
  801006:	89 45 e0             	mov    %eax,-0x20(%ebp)
  801009:	89 55 e4             	mov    %edx,-0x1c(%ebp)
    return (int)do_div(result, RAND_MAX + 1);
  80100c:	c7 45 dc 00 00 00 80 	movl   $0x80000000,-0x24(%ebp)
  801013:	8b 45 e0             	mov    -0x20(%ebp),%eax
  801016:	8b 55 e4             	mov    -0x1c(%ebp),%edx
  801019:	89 45 d8             	mov    %eax,-0x28(%ebp)
  80101c:	89 55 e8             	mov    %edx,-0x18(%ebp)
  80101f:	8b 45 e8             	mov    -0x18(%ebp),%eax
  801022:	89 45 ec             	mov    %eax,-0x14(%ebp)
  801025:	83 7d e8 00          	cmpl   $0x0,-0x18(%ebp)
  801029:	74 1c                	je     801047 <rand+0x9d>
  80102b:	8b 45 e8             	mov    -0x18(%ebp),%eax
  80102e:	ba 00 00 00 00       	mov    $0x0,%edx
  801033:	f7 75 dc             	divl   -0x24(%ebp)
  801036:	89 55 ec             	mov    %edx,-0x14(%ebp)
  801039:	8b 45 e8             	mov    -0x18(%ebp),%eax
  80103c:	ba 00 00 00 00       	mov    $0x0,%edx
  801041:	f7 75 dc             	divl   -0x24(%ebp)
  801044:	89 45 e8             	mov    %eax,-0x18(%ebp)
  801047:	8b 45 d8             	mov    -0x28(%ebp),%eax
  80104a:	8b 55 ec             	mov    -0x14(%ebp),%edx
  80104d:	f7 75 dc             	divl   -0x24(%ebp)
  801050:	89 45 d8             	mov    %eax,-0x28(%ebp)
  801053:	89 55 d4             	mov    %edx,-0x2c(%ebp)
  801056:	8b 45 d8             	mov    -0x28(%ebp),%eax
  801059:	8b 55 e8             	mov    -0x18(%ebp),%edx
  80105c:	89 45 e0             	mov    %eax,-0x20(%ebp)
  80105f:	89 55 e4             	mov    %edx,-0x1c(%ebp)
  801062:	8b 45 d4             	mov    -0x2c(%ebp),%eax
}
  801065:	83 c4 24             	add    $0x24,%esp
  801068:	5b                   	pop    %ebx
  801069:	5e                   	pop    %esi
  80106a:	5f                   	pop    %edi
  80106b:	5d                   	pop    %ebp
  80106c:	c3                   	ret    

0080106d <srand>:
/* *
 * srand - seed the random number generator with the given number
 * @seed:   the required seed number
 * */
void
srand(unsigned int seed) {
  80106d:	f3 0f 1e fb          	endbr32 
  801071:	55                   	push   %ebp
  801072:	89 e5                	mov    %esp,%ebp
    next = seed;
  801074:	8b 45 08             	mov    0x8(%ebp),%eax
  801077:	ba 00 00 00 00       	mov    $0x0,%edx
  80107c:	a3 00 20 80 00       	mov    %eax,0x802000
  801081:	89 15 04 20 80 00    	mov    %edx,0x802004
}
  801087:	90                   	nop
  801088:	5d                   	pop    %ebp
  801089:	c3                   	ret    

0080108a <main>:
#include <stdio.h>
#include <ulib.h>

int
main(void) {
  80108a:	f3 0f 1e fb          	endbr32 
  80108e:	55                   	push   %ebp
  80108f:	89 e5                	mov    %esp,%ebp
  801091:	83 e4 f0             	and    $0xfffffff0,%esp
  801094:	83 ec 10             	sub    $0x10,%esp
    cprintf("I read %8x from 0.\n", *(unsigned int *)0);
  801097:	b8 00 00 00 00       	mov    $0x0,%eax
  80109c:	8b 00                	mov    (%eax),%eax
  80109e:	89 44 24 04          	mov    %eax,0x4(%esp)
  8010a2:	c7 04 24 c0 13 80 00 	movl   $0x8013c0,(%esp)
  8010a9:	e8 d3 f2 ff ff       	call   800381 <cprintf>
    panic("FAIL: T.T\n");
  8010ae:	c7 44 24 08 d4 13 80 	movl   $0x8013d4,0x8(%esp)
  8010b5:	00 
  8010b6:	c7 44 24 04 07 00 00 	movl   $0x7,0x4(%esp)
  8010bd:	00 
  8010be:	c7 04 24 df 13 80 00 	movl   $0x8013df,(%esp)
  8010c5:	e8 56 ef ff ff       	call   800020 <__panic>
